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 am working on documenting my API and found that DRF can use OpenAPI schemas to automatically generate documentation.
I noticed that all parameters schema type gets set to string although I am using non-string filters like for example the BooleanFilter. OpenAPI seems to support other schema types and formats. Upon further investigating I found that DRF is calling DjangoFilterBackend.get_schema_operation_parameters to get schema parameters and this intern always sets the type to string regardless of filter type.
My solution was to override the beforementioned function and set appropriate types and formats but this functionality should probably be part of django-filter. Perhaps every Filter should define schema type/format as class parameters which are then used when generating the schema.
The text was updated successfully, but these errors were encountered:
My current setup:
I am working on documenting my API and found that DRF can use OpenAPI schemas to automatically generate documentation.
I noticed that all parameters schema type gets set to string although I am using non-string filters like for example the BooleanFilter. OpenAPI seems to support other schema types and formats. Upon further investigating I found that DRF is calling
DjangoFilterBackend.get_schema_operation_parameters
to get schema parameters and this intern always sets the type to string regardless of filter type.My solution was to override the beforementioned function and set appropriate types and formats but this functionality should probably be part of
django-filter
. Perhaps everyFilter
should define schema type/format as class parameters which are then used when generating the schema.The text was updated successfully, but these errors were encountered: