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

Deprecate in-built Schema support in favour of drf-spectacular #1432

Closed
carltongibson opened this issue Aug 26, 2021 · 8 comments · Fixed by #1574
Closed

Deprecate in-built Schema support in favour of drf-spectacular #1432

carltongibson opened this issue Aug 26, 2021 · 8 comments · Fixed by #1574

Comments

@carltongibson
Copy link
Owner

carltongibson commented Aug 26, 2021

There are a number of related issues with schema generation. I’m gathering them here so that they can be addressed together. Closing the original issues.

@sim1234
Copy link

sim1234 commented Apr 13, 2022

How about actually fixing it?

@carltongibson
Copy link
Owner Author

As per #1534...

I recommend checking out drf-spectacular if you're working with schemas.

https://drf-spectacular.readthedocs.io/en/latest/readme.html

It's a lot better developed than other options, including the basic in-core support.

I'm likely to deprecate the built-in support in favour of this in the 23.x series.

@carltongibson carltongibson pinned this issue Sep 14, 2022
@carltongibson carltongibson changed the title Various Schema Improvements Deprecate in-built Schema support in favour of drf-spectacular Sep 14, 2022
@carltongibson
Copy link
Owner Author

RFC on drf-spectacular: tfranzel/drf-spectacular#862

@tfranzel
Copy link

How about actually fixing it?

@sim1234 The reason is actually quiet simple. Generating a solid schema inside django-filter would require adding hundreds of LOC that would solely deal with creating the necessary introspection tooling. Since drf-spectacular already contains all that tooling, it would be reinventing a really intricate wheel here.

@royalroot
Copy link

royalroot commented Apr 14, 2023

I have a question that belongs loosely to this topic. I use many ChoiceFilters in combination with drf and drf-spectacular.

To get things working I had to put in the field_name of the model (yes that's clear so far) and the choices="Defined Choices" of my model. But when I'm doing this in the docs of drf-spectacular everything is doubled in the examples.
Without choices="Defined Choices" the API is not working.

What am I doing wrong? Can somebody point me in the right direction?

@tfranzel
Copy link

@nicro87 you mean doubled in the schema? Please open an issue in https://github.com/tfranzel/drf-spectacular/issues

Provide an (ideally self-contained) example for your filter as well as the resulting schema. This is a complicated feature and examples make it a lot easier to talk about.

carltongibson added a commit that referenced this issue Apr 23, 2023
* To be removed in v25.
* Use drf-spectacular.

Closes #1432. Closes #1573.
carltongibson added a commit that referenced this issue Apr 23, 2023
* To be removed in v25.
* Use drf-spectacular.

Closes #1432. Closes #1573.
carltongibson added a commit that referenced this issue Apr 23, 2023
* To be removed in v25.
* Use drf-spectacular.

Closes #1432. Closes #1573.
carltongibson added a commit that referenced this issue Apr 23, 2023
* To be removed in v25.
* Use drf-spectacular.

Closes #1432. Closes #1573.
carltongibson added a commit that referenced this issue Apr 23, 2023
* To be removed in v25.
* Use drf-spectacular.

Closes #1432. Closes #1573.
@carltongibson
Copy link
Owner Author

This was done in #1574. Deprecations will be in v23.2 that I'll roll this ≈week. Built-in schema methods will be removed from the DRF backend in v25.1.

@carltongibson carltongibson unpinned this issue Apr 30, 2023
@adamJLev
Copy link

adamJLev commented Feb 1, 2024

how do we migrate this to the new drf-spectacular generated schema to silence the warnings? maybe some info in the docs would be great. thank you!

================================================= warnings summary ==================================================
tests/functional/docs/test.py::test_api_docs_pages_authentication
  /Users/...lib/python3.11/site-packages/django_filters/rest_framework/backends.py:134: RemovedInDjangoFilter25Warning: 
Built-in schema generation is deprecated. Use drf-spectacular.
    warnings.warn(

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

Successfully merging a pull request may close this issue.

5 participants