You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want show only fews details for ItemCategory when is inside Item so i added DynamicFieldsModelSerializer and on category_obj fields=['id', 'name', ]
when i generate full schema model of ItemCategory lose all fields except id and name, instead if i remove fields=['id', 'name', ]
the autogenerated schema will have all fields,
that is a problem because when i make my view with ItemCategory i want all fields, seems autogenerated
ItemCategorySerializer( fields=['id', 'name', ])
replace ItemCategorySerializer() called before
Expected behavior
i Expect to have all fields in my ItemCategory schema w/o create a new serializer
The text was updated successfully, but these errors were encountered:
i found a solution, i don't like it but works
but the real problem is we can't controll order of Serializers so only the first one is generated if is already presen't wont replace the old one or extend... so i solvedin that way
Describe the bug
With DynamicFieldsModelSerializer from django rest framework swagger dosen't produce the full schema of object
https://www.django-rest-framework.org/api-guide/serializers/#dynamically-modifying-fields
To Reproduce
take two models with some different fields and their serializers
class ItemCategorySerializer(DynamicFieldsModelSerializer ):
class Meta:
model = ItemCategory
fields = "all"
class ItemSerializer(DynamicFieldsModelSerializer):
class Meta:
model = Item
fields = "all"
I want show only fews details for ItemCategory when is inside Item so i added DynamicFieldsModelSerializer and on category_obj fields=['id', 'name', ]
when i generate full schema model of ItemCategory lose all fields except id and name, instead if i remove fields=['id', 'name', ]
the autogenerated schema will have all fields,
that is a problem because when i make my view with ItemCategory i want all fields, seems autogenerated
ItemCategorySerializer( fields=['id', 'name', ])
replace ItemCategorySerializer() called before
Expected behavior
i Expect to have all fields in my ItemCategory schema w/o create a new serializer
The text was updated successfully, but these errors were encountered: