NelmioApiDocBundle: [JMSModelDescriber] Title and Description missing on virtual properties.
When using VirtualProperty the title and description do not get populated in documentation:
Results in:
A current workaround is to create an actual property which will not be used and define its accessor to be the method used for virtual property like so:
Resulting in:
I have narrowed it down to this section of the code in Nelmio\ApiDocBundle\ModelDescriber\JMSModelDescriber
In case of VirtualPropertyMetadata, the $item->reflection
is null so $annotationsReader->updateProperty()
(which parses the title/description) is never called.
It should be possible to use method reflection to load this info.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 17
The first solution you tried is the one that is supported 😊 There is a small typo in it though, there is an extra parenthesis after your
@SWG\Property
annotations 😉Having an exception in this case could help debug, contributions are greatly appreciated in case you’d like to introduce this small but super important change 😃
Wow, that was quick.Thanks @GuilhemN ! And I searched and tried for hours without luck … yeah the documentation issue, we (maintainers of some software) all know that topic 😁
But I run promptly into another issue: your solution works for one property, can I make that working for multiple virtual properties as well?
This don’t work:
Neither does this:
The first one that is found is displayed, the other one is silently skipped. Can I nest multiple
@SWG\Property
on class level and if so: how?Sorry for polluting this closed issue, but I figure this is still related to the topic “Title and Description missing on virtual properties”!?
@GuilhemN thanks for this update! Unfortunately I had to pause the extensive work on this library, I hope to get again a project where this feature is needed.