Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the deprecated CoreAPI-based schema/documentation stack from Django REST framework, leaving OpenAPI as the only built-in schema generation/rendering path and cleaning up associated tests, templates, and optional dependencies.
Changes:
- Remove CoreAPI schema generation, renderers, docs views/templates/assets, and the
CoreAPIClient. - Simplify schema views/management command to OpenAPI-only behavior.
- Delete CoreAPI-focused tests and update remaining tests to match the new surface area.
Reviewed changes
Copilot reviewed 44 out of 49 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/urls.py | Removes docs URLConf usage; leaves empty urlpatterns for test suite. |
| tests/test_templatetags.py | Removes CoreAPI templating tests and related imports. |
| tests/test_renderers.py | Removes DocumentationRenderer/SchemaJSRenderer/CoreAPI renderer tests and imports. |
| tests/test_filters.py | Removes CoreAPI schema field testing and mocks tied to CoreAPI. |
| tests/test_encoders.py | Removes JSONEncoder behavior test specific to coreapi objects. |
| tests/test_api_client.py | Deletes CoreAPIClient integration tests and fixtures. |
| tests/schemas/test_managementcommand.py | Removes CoreAPI mode tests; keeps OpenAPI management command coverage. |
| tests/schemas/test_get_schema_view.py | Removes CoreAPI schema view test path; keeps OpenAPI assertions. |
| tests/schemas/test_coreapi.py | Deletes the CoreAPI schema generator/inspector test suite. |
| rest_framework/utils/encoders.py | Removes JSONEncoder special-casing of coreapi Document/Error objects. |
| rest_framework/test.py | Removes CoreAPIClient from the testing utilities module. |
| rest_framework/templatetags/rest_framework.py | Removes CoreAPI-docs-specific template tags/filters. |
| rest_framework/templates/rest_framework/schema.js | Deletes CoreAPI schema JS bootstrap template. |
| rest_framework/templates/rest_framework/docs/sidebar.html | Deletes legacy interactive docs sidebar template. |
| rest_framework/templates/rest_framework/docs/link.html | Deletes legacy interactive docs endpoint template. |
| rest_framework/templates/rest_framework/docs/langs/shell.html | Deletes CoreAPI CLI snippet template. |
| rest_framework/templates/rest_framework/docs/langs/shell-intro.html | Deletes CoreAPI CLI install snippet template. |
| rest_framework/templates/rest_framework/docs/langs/python.html | Deletes CoreAPI Python client snippet template. |
| rest_framework/templates/rest_framework/docs/langs/python-intro.html | Deletes CoreAPI Python client install snippet template. |
| rest_framework/templates/rest_framework/docs/langs/javascript.html | Deletes CoreAPI JS client snippet template. |
| rest_framework/templates/rest_framework/docs/langs/javascript-intro.html | Deletes CoreAPI JS client loading snippet template. |
| rest_framework/templates/rest_framework/docs/interact.html | Deletes interactive “try it” modal template. |
| rest_framework/templates/rest_framework/docs/index.html | Deletes legacy interactive docs index template. |
| rest_framework/templates/rest_framework/docs/error.html | Deletes legacy docs error template. |
| rest_framework/templates/rest_framework/docs/document.html | Deletes legacy docs document layout template. |
| rest_framework/templates/rest_framework/docs/auth/token.html | Deletes legacy docs token auth modal template. |
| rest_framework/templates/rest_framework/docs/auth/session.html | Deletes legacy docs session auth modal template. |
| rest_framework/templates/rest_framework/docs/auth/basic.html | Deletes legacy docs basic auth modal template. |
| rest_framework/static/rest_framework/docs/js/jquery.json-view.min.js | Deletes legacy docs JSON viewer dependency. |
| rest_framework/static/rest_framework/docs/js/api.js | Deletes legacy docs interactive client JS. |
| rest_framework/static/rest_framework/docs/img/grid.png | Removes legacy docs image asset. |
| rest_framework/static/rest_framework/docs/img/favicon.ico | Removes legacy docs favicon asset. |
| rest_framework/static/rest_framework/docs/css/jquery.json-view.min.css | Deletes legacy docs JSON viewer CSS. |
| rest_framework/static/rest_framework/docs/css/highlight.css | Deletes legacy docs syntax highlight CSS. |
| rest_framework/static/rest_framework/docs/css/base.css | Deletes legacy docs base styling. |
| rest_framework/schemas/views.py | Makes SchemaView renderer selection OpenAPI-only. |
| rest_framework/schemas/coreapi.py | Deletes CoreAPI schema generator/inspectors module. |
| rest_framework/schemas/init.py | Removes CoreAPI exports/selection logic; exports OpenAPI AutoSchema/SchemaGenerator. |
| rest_framework/renderers.py | Deletes CoreAPI renderers + documentation renderer/SchemaJS renderer implementations. |
| rest_framework/pagination.py | Removes CoreAPI get_schema_fields() hooks from pagination classes. |
| rest_framework/management/commands/generateschema.py | Removes CoreAPI modes/format options; OpenAPI-only output. |
| rest_framework/filters.py | Removes CoreAPI get_schema_fields() hooks from filter backends. |
| rest_framework/documentation.py | Deletes legacy docs URL helpers (include_docs_urls, etc.). |
| rest_framework/compat.py | Removes optional coreapi/coreschema shims; keeps uritemplate/yaml/requests optionals. |
| rest_framework/authtoken/views.py | Removes CoreAPI ManualSchema definition from token view. |
| rest_framework/init.py | Removes RemovedInDRF318Warning deprecation warning class. |
| pyproject.toml | Removes CoreAPI-related optional deps; adjusts dependency groups (adds requests, adds uritemplate). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
16d4bae to
8494937
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 46 out of 51 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@auvipy did you want to check anything in particular before we decide to merge it? I realise it's quite a big one... |
|
sure |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 46 out of 51 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| class CustomAutoSchema(AutoSchema): | ||
| def get_link(self, path, method, base_url): | ||
| def get_operation(self, path, method): |
There was a problem hiding this comment.
can you explain a bit about the rename?
There was a problem hiding this comment.
The from rest_framework.schemas import AutoSchema now resolve to rest_framework.schemas.openapi.AutoSchema instead of rest_framework.schemas.coreapi.AutoSchema.
The get_link method from the Core API version doesn't exist in the Open API variant, but the get_operation is the equivalent: it collects paths, filters and pagination parameters for the API schema. The CoreAPI version was returning a coreapi.Link object while the Open API returns a dict following the schema Open API expects.
So it's not really a rename, it's more of an API difference between the 2 AutoSchema variants.
| generator_class = coreapi.SchemaGenerator | ||
| else: | ||
| generator_class = openapi.SchemaGenerator | ||
| generator_class = openapi.SchemaGenerator |
There was a problem hiding this comment.
drf already have build in openapi schema generator? just want to clear my self about this
There was a problem hiding this comment.
I'm not sure what the difference with the coreapi.SchemaGenerator, but as it was what was returned when coreapi wasn't installed, this branch is left untouched.
We might be able to remove that in the future but as far as I understand this is out of scope here.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
# Conflicts: # docs/api-guide/testing.md
|
I apologize for the delayed response. There are currently no commit records for the previous version. :( Since design discussions hadn't taken place yet, I felt it would be premature for me to proceed with a PR. Thank you so much for your excellent work on the project. |
|
If we are not involved in schema creation, should we also remove the schema-related configuration code in settings.py? Or should we consider it an interface for third-party packages? from docs...
drf-spectacular directly uses these items from the existing DRF's settings.py. |
|
may be we can defer this for 3.18? in the mean time we will learn more about the available best packages and other goodies.... |
For me that's the interface for 3rd party packages and should not be changed here. We can review later, but the only point of this PR is to do the bare minimum to eliminate the dependency on the coreapi package. the project is archived and is widely out of date, it uses some old
By "this" do you mean this PR or what was suggested in the message directly above? I'd like to get this PR merged for 3.17 but more than happy to review @TGoddessana suggestions after 3.17... |
Description
Note
Most of this PR was AI generated (Claude code).
At time of opening this, I haven't had time to carefully review the code myself yet, and will put it in ready for review when I've done so.I've now review it and what is removed makes sense, but I'm not sure if there is more we can/shoul remove...Opening this as another attempt to do #9583 opening this for visibility in case others are interested.
Testing status:
FYI @TGoddessana as you started the original PR (do you still have the old commits somewhere?)
Give this a spin
If you want to install this branch on your project:
refs #8453