Drf_spectacular not picking up complex objects
I have a serializer that looks something like this (greatly simplified)
class MySerializer(serializers.Serializer):
parameters = Parameters(many=True, default=[])
class Parameters(BaseSerializer):
param_name = serializers.CharField(required=True, allow_blank=False)
param_count = serializers.IntegerField(required=True)
The drf_spectacular annotations are
@extend_schema(
request=None,
responses={
200: MySerializer,
400: ErrorResponseSerializer,
500: ErrorResponseSerializer
},
description="Load all data"
)
The swagger that is being generated for the parameters
field is
"parameters": [],
How can I get it to generate the contents of the list with a sample parameter
object. Why isn't drf_spectacular picking it up from the serializers?