Open K0Te opened 5 years ago
Nested serializers probably work just fine, but it's the swagger UI that only shows the example object of the root model on the request. If you look in the models section at the nested serializers you should also see its example.
Is it possible to change behavior, so that parent serializers swagger_schema_fields would be extended with child's ones
While it might make sense for the particular case of example
, I don't think it would be a good idea in general..
Hi,
At the moment drf-yasg uses
swagger_schema_fields->example
only from top-level serializer, so that child's serializers examples are lost. Thus code duplication is required for full example documentation in case of nested serializers. Is it possible to change behavior, so that parent serializersswagger_schema_fields
would be extended with child's ones, unless matching field is explicitly set ? I will be happy to create PR for this change.