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:
/*
* @ORM\Embedded(class="App\Entity\Id")
* @ApiProperty(
* attributes={
* "swagger_context"={
* "type"="object",
* "properties"= {
* "type" = "int",
* "code" = "string",
* },
* "example"={"type":1, "code":"1234567-1"}
* }
* }
* )
*
* /
private $embeddedThing;
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:
* @ApiProperty(
* attributes={
* "swagger_context"={
* "$ref"="#/definitions/Id"
* }
* }
* )
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?
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?