NelmioApiDocBundle
NelmioApiDocBundle copied to clipboard
@JMS\VirtualProperty not working when using @JMS\Groups
Hello, I noticed a bug today: when looking at the API documentation if I have a model with @JMS\VirtualProperty and @JMS\Groups the virtual property is not correctly displayed in the documentation.
The property is correctly serialized when calling the web service, the problem is just in the documentation:
/**
* Returns the posting user.
*
* @JMS\VirtualProperty
* @JMS\Type("AppBundle\Entity\User")
* @JMS\Groups({"homepage"})
* @JMS\Expose
*/
public function getUser()
{
return $this->challengeEntry->getUser();
}
Thanks!
You may look at this issue: https://github.com/nelmio/NelmioApiDocBundle/issues/1412
@lukepass can you please explain in detail what it means "the virtual property is not correctly displayed in the documentation"?
Hello @goetas! I mean that the property is not shown in the "preview" below the Description section for the responses. Here:

Thanks!
Did you specify in the controller @Model(type=User::class, groups={"homepage"}) ?
In my controller I am setting the view correctly but as I said the controller's output is correct, the property is serialized. It's just the documentation that isn't updated with the value.
I am not able to reproduce this issue, could you give us some more details about your controller and your entity ? A small reproducer would also help if you have some time to create one :)