-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hiding Fields in Serializers #100
Comments
there is no mechanism for that. It is likely doable with a custom Extension (https://drf-spectacular.readthedocs.io/en/latest/customization.html#declare-serializer-magic-with-openapiserializerextension) and if not with a postprocessing hook (step 5). not sure if its worth the effort though. |
I tried creating a custom serializer field (e.g. Would it be incorrect for fields marked |
i tried reproducing your statement with a test but was unable to fcee218#diff-05942919b2ed60a337f71617b2dbce8fR698
i also did a small improvement to
i gave this a bit more thought and i think it is a reasonable feature. in fact it was a tiny change. |
@savitmk could you test the changes and comment on the issue reproduction? thanks. |
this is perfect, thank you!
@extend_schema_field(OpenApiTypes.NONE)
class MyField(serializers.Field):
pass In my serializer: class ExampleSerializer(serializers.Serializer):
my_field = MyField() On latest release On latest |
i tracked the bug. it was already fixed in |
What would be the best method for hiding a subset of fields on a serializer?
The text was updated successfully, but these errors were encountered: