Hello,
I'm using API-Platform using a Resource Yaml file. And some cusotm stuff (Data provider for example).
I Have a strange bahavior at this point.
Each of my operations have specific Serializer Group and each property have a list of serialization group related to the operations. So I expect to see this reflected in the Swagger documentation and see only the property defined by the serialization groups.
But it's not the case. the DocumentationNormalizer return all the propreties of each object.
Digging a little bit in the code I found that the problem is coming from ExtractorPropertyNameCollectionFactory.
During the process everything is operating as expected and the properties are filtered by serialization group. But so at line 65 we have a condition who is basically getting all the the properties of the resource and reinjecting all of them:
if ($properties = $this->extractor->getResources()[$resourceClass]['properties'] ?? false) {
foreach ($properties as $propertyName => $property) {
$propertyNames[$propertyName] = $propertyName;
}
}
If I comment this the doc seem to work as expected.
Can I have a confirmation it's a bug or not ?
Thanks.
I ran into this same issue recently as well, I would vote that this is a bug. I would expect only properties in a serialization group to be displayed in the swagger documentation. However, the above snippet makes anything with an "ApiProperty" annotation be displayed as well.
Most helpful comment
I ran into this same issue recently as well, I would vote that this is a bug. I would expect only properties in a serialization group to be displayed in the swagger documentation. However, the above snippet makes anything with an "ApiProperty" annotation be displayed as well.