Replies: 12 comments
-
Just an additional note. I tried also to define the Embeddable as ApiResources. If I give even one dummy operation the model gets generated on the documentation properly. If I remove all the operations it won't include the model. Embedding the element gives:
I think there was a workaround using serialization groups but I'm afraid this road is doomed to fail in the end. |
Beta Was this translation helpful? Give feedback.
-
Update: Using ApiResource annotation in embeddables is definitely not the way to go. Gives all sort of problems. So I'll return to my original question. I could define the reference on embedding side with swagger_context and using But is there any way to force the generation of models from Embeddables? Everything else works just fine but the documentation is off and I don't want to manage it manually using swagger_context everywhere on the embedding resource. Any ideas on how to approach this? |
Beta Was this translation helpful? Give feedback.
-
I stumbled on the same problem. For the autogen feature : My idea :
|
Beta Was this translation helpful? Give feedback.
-
Any progress on this? |
Beta Was this translation helpful? Give feedback.
-
I ended up with an internal solution, I can't share the code for now, but here is the idea :
Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
FYI, |
Beta Was this translation helpful? Give feedback.
-
Why did it break @Cethy ? |
Beta Was this translation helpful? Give feedback.
-
@soyuka the changes made in But I was led to believe the |
Beta Was this translation helpful? Give feedback.
-
Hi, I guess I found one way to walk it through, but first we must know why So what should be done is to create an object definition for you embeddable entity first, and then refer to it from the embedding entities. Let say: First the embedded entity
The Swagger decorator service
Registering the service
Finally refering to the embeddable definition from the embedding resource
Done |
Beta Was this translation helpful? Give feedback.
-
@sorel-kui , while being documented and reasonable solution, it seems requiring more work to do than simply define all properties straight inside "swagger_context". |
Beta Was this translation helpful? Give feedback.
-
Hi, for Information, I have the same problem than @paali with MongoDB and I've applied the solution given by @sorel-kui without defining Embedding as a ApiResource. example for MongoDB :
|
Beta Was this translation helpful? Give feedback.
-
Could you give #3309 a try? And let me know if you encounter some issues with that and/or what's still missing. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Not a bug probably but I just can't wrap my head around this one. I've read like 50 issues about embedded objects but nothing seems to solve my issue.
I have an
@ORM\Embeddable
that's used quite a lot in other real resources. Serialization/deserialization seem to work just fine. But the swagger documentation is giving me headache.I can of course do something like:
But that seems really counterproductive when I have multiple users for the embeddable. I just wouldn't like to maintain it like this.
Couple of solution possibilities comes to mind. The optimal solution would be to pull the embedded entity as a swagger schema automatically and referencing it in the parent.
I could live with something like this:
But I just can't seem to figure out how to make API Platform create that model for my Id embeddable.
Any ideas how to approach this? Can I somehow force the model creation from Embeddables? Any workaround other than maintaining the embeddable documentation manually?
Beta Was this translation helpful? Give feedback.
All reactions