NelmioApiDocBundle
NelmioApiDocBundle copied to clipboard
Merge Parent and Child Property OpenAPI Annotation/Attribute Configuration
Is it possible to override parent properties in the child.
I have a parent class which has the property "class" and this is being extended by two separate child classes. Is it possible that for each child class I can have a different example?
Can you explain a bit better your question and how it relates to NelmioApiDocBundle ?
Ok so, I have an abstract class called AbstractResponse. In this one I have a property called class, which is always set to the class name snake case.
So if I have
- CatResponse extends AbstractResponse, the class property will be cat_response
- DogResponse extends AbstractResponse, the class property will be dog_response
Now in the AbstractResponse I have
/**
* @Groups({"response"})
*
* @SWG\Property(
* description="The class of the object response.",
* type="string",
* example="object_response"
* )
*/
public $class;
Which in the final documentation renders fine for both CatResponse object and DogResponse object, but my question is if I'm able to somehow override that example
property inside my child classes so that for CatResponse in the example it will show me "class": "cat_response", and for DogResponse in the example it will show me "class: "dog_response".
Do you think its more related to php-swagger?
This sounds like maybe the idea is to work our way up a class hierarchy and read then merge annotations on the way up?