Repository navigation
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. |
|
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? |
|
I stumbled on the same problem. For the autogen feature : My idea :
|
|
Any progress on this? |
|
I ended up with an internal solution, I can't share the code for now, but here is the idea :
Hope it helps. |
|
FYI, |
|
@soyuka the changes made in But I was led to believe the |
|
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 |
|
@sorel-kui , while being documented and reasonable solution, it seems requiring more work to do than simply define all properties straight inside "swagger_context". |
|
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 : |
|
Could you give #3309 a try? And let me know if you encounter some issues with that and/or what's still missing. |
Uh oh!
There was an error while loading. Please reload this page.
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\Embeddablethat'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?
All reactions