Skip to content
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

Add support for OpenAPI parameter schema types #1258

Closed
robertcv opened this issue Aug 18, 2020 · 1 comment
Closed

Add support for OpenAPI parameter schema types #1258

robertcv opened this issue Aug 18, 2020 · 1 comment

Comments

@robertcv
Copy link

My current setup:

Django==2.2.14
djangorestframework==3.10.3
django-filter==2.3.0

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.

@carltongibson
Copy link
Owner

Moving to #1432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants