Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Drop coreapi support for DRF 3.17#9583

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
TGoddessana wants to merge5 commits intoencode:main
base:main
Choose a base branch
Loading
fromTGoddessana:drop-coreapi-support

Conversation

@TGoddessana
Copy link
Contributor

Description

refs#8453

As discussed in#8453, we are deprecating the coreapi for drf 3.17.

I read the discussion in detail, and I'm wondering if it was decided to “leave all schema generation logic in the library that generates the schema (drf-spectacular), and drf will not be involved in schema generation” (drf-spectacular will be part of drf?) The comments in the linked discussion say that...

Yes. The idea would be to leave (just) the extension points in place, as they are.

onny reacted with thumbs up emojiulgens reacted with thumbs down emoji
@TGoddessana
Copy link
ContributorAuthor

TGoddessana commentedMar 21, 2025
edited
Loading

Question while working with PR.

Thedocumentation says: “Support for generating default schemas will be moved to a separate package and then removed”. For this PR, should we remove coreapi and everything related to it, or all code related to the wholerest_framework/schemas/ package?

If you need to remove everything related to schemas from theRest Framework, you can remove most of the code, tests, etc. in/schemas. What do you team think about this?

@TGoddessana
Copy link
ContributorAuthor

@auvipy I'm sorry if the tags are annoying. But this is the only place we can make design decisions about PR, and I'd love to hear your thoughts on what I should do..

@auvipy
Copy link
Collaborator

yes please fix the merge conflicts as we have to remove it

@TGoddessana
Copy link
ContributorAuthor

I guess this is where we need to make a decision on where we stop supporting it... For example, should we remove all schema-related references in rest_framework.settings since schema generation will stop?

The documentation certainly mentions that we will be removing API documentation, but I'm confused if removing all code likeschemas.utils orrenderers.CoreJSONRenderer is included in this scope.

@TGoddessana
Copy link
ContributorAuthor

image

For example, the APIView class defaults to the DefaultSchema() class that was included in the schema package.

If we were to remove schema generation, would it be right to remove these codes as well?

@browniebrokebrowniebroke added this to the3.17 milestoneJul 6, 2025
@browniebroke
Copy link
Member

That's a big one! I didn't expect to see some much code deleted, but I can see there was a lot of tests...

If we were to remove schema generation, would it be right to remove these codes as well?

Would be interesting to see what drf-spectacular or drf-yasg are using to hook into DRF, and make sure we don't break their integration point. Might be a good idea to coordinate this with them.

auvipy reacted with thumbs up emoji

@TGoddessana
Copy link
ContributorAuthor

Alright, I think it's best to restart the PR, so I've reverted the commit. Both packages directly depend on this part of rest_framework. Let's see this..

(Some parts of this content were generated using AI. :) I think it's a really useful tool for situations like this. But basically, I found and verified all the code references myself.)

drf-spectacular

Essential Components to Maintain

ComponentLocationTypePurposedrf-spectacular Usage
ViewInspectorrest_framework.schemas.inspectorsBase ClassCore schema inspection interfaceInherited byAutoSchema class
BaseSchemaGeneratorrest_framework.schemas.generatorsBase ClassSchema generation interfaceUsed by drf-spectacular generators
BaseEndpointEnumeratorrest_framework.schemas.generatorsBase ClassAPI endpoint discovery logicExtended byEndpointEnumerator
get_pk_descriptionrest_framework.schemas.utilsUtility FunctionPrimary key field descriptionDirect import and usage

Components Safe to Remove

ComponentLocationTypeReason for Removal
AutoSchema (DRF's implementation)rest_framework.schemasClassReplaced by drf-spectacular's AutoSchema
CoreAPI schema generatorsrest_framework.schemas.coreapiModuleLegacy schema format
OpenAPI 2.0 generatorsrest_framework.schemas.openapiModuleSuperseded by drf-spectacular
Schema view implementationsrest_framework.schemas.viewsModuleCustom implementations available

Critical Interfaces to Preserve

InterfaceMethod/AttributeRequired for Compatibility
ViewInspectorget_operation()Method signature and base behavior
ViewInspectorget_description()Method signature
ViewInspectorget_summary()Method signature
BaseEndpointEnumeratorget_api_endpoints()Method signature and return format
BaseEndpointEnumeratorget_path_from_regex()Method signature
BaseSchemaGeneratorBase interfaceClass structure and constructor

drf-yasg

Essential Components to Maintain

ComponentLocationTypePurposedrf-yasg Usage
EndpointEnumeratorrest_framework.schemas.generatorsBase ClassAPI endpoint discovery logicExtended by customEndpointEnumerator
SchemaGeneratorrest_framework.schemas.openapiBase ClassOpenAPI schema generationUsed as base for drf-yasg generator
get_pk_descriptionrest_framework.schemas.utilsUtility FunctionPrimary key field descriptionDirect import and usage
get_pk_namerest_framework.schemas.generatorsUtility FunctionPrimary key field name extractionDirect import and usage
endpoint_orderingrest_framework.schemas.generatorsUtility FunctionEndpoint sorting logicDirect import and usage
AutoSchemarest_framework.schemasClassSchema inspection interfaceUsed internally bySwaggerAutoSchema

Components Safe to Remove

ComponentLocationTypeReason for Removal
DRF's default OpenAPI implementationrest_framework.schemas.openapiImplementationReplaced by drf-yasg's implementation
CoreAPI schema generatorsrest_framework.schemas.coreapiModuleLegacy schema format
Default schema view implementationsrest_framework.schemas.viewsModuleCustom implementations available

Critical Interfaces to Preserve

InterfaceMethod/AttributeRequired for Compatibility
EndpointEnumeratorget_path_from_regex()Method signature and regex processing
EndpointEnumeratorshould_include_endpoint()Method signature for endpoint filtering
SchemaGeneratorBase class structureConstructor and inheritance compatibility
AutoSchemaview attributeUsed bySwaggerAutoSchema._sch.view
Utility functionsImport pathsAll utility function locations must remain stable

Key Differences from drf-spectacular

Aspectdrf-yasgdrf-spectacular
Base Schema ClassUsesAutoSchema internallyInherits fromViewInspector
Generator ApproachExtendsSchemaGeneratorUsesBaseSchemaGenerator
Endpoint DiscoveryHeavily customizesEndpointEnumeratorExtendsBaseEndpointEnumerator
Utility DependenciesMore extensive use of DRF utilitiesMinimal utility usage

@TGoddessana
Copy link
ContributorAuthor

TGoddessana commentedSep 21, 2025
edited
Loading

In my view, there are two possible approaches:

  1. Remove all schema-related code and settings from DRF, requiring both packages to redefine the relevant dependency code within theschemas package. This would fully eliminate the schema generation logic, which I believe results in a cleaner overall design.

  2. Retain the dependent code as summarized above. While this would leave some legacy code in place, it would preserve compatibility.

From a maintenance perspective, I tend to favor Option 1 (removing all schema-related code). The deprecation ofcoreapi has been clearly noted in both the codebase and documentation for some time, and it seems more sustainable for DRF not to maintain direct dependencies on third-party packages(similar to how Django continues to evolve without holding back updates purely for compatibility with DRF.).

@TGoddessana
Copy link
ContributorAuthor

drf-spectacular directly uses these items from the existing DRF'ssettings.py.

DEFAULT_SCHEMA_CLASSCOERCE_DECIMAL_TO_STRINGUPLOADED_FILES_USE_URLURL_FORMAT_OVERRIDEFORMAT_SUFFIX_KWARG

As long as DRF does not participate in schema creation, could removing theDEFAULT_SCHEMA_CLASS api from the above items be a good starting point?

@browniebroke
Copy link
Member

Sorry about the lack of feedback here, I'm not too sure how to get this one across the line without breaking other documentation packages like drf-spectacular, and will need some time to understand that.

We are aiming to move the project to@django-commons on Friday and as part of the move, we're planning to do a release. With the list of unreleased changes on main, we will have to bump the minor digit to 3.17, but realistically this PR won't make the cut.

Would you be interested in sending a pull request to update the deprecation warning from 3.17 to 3.18? feel free to say no if you won't have time...

Thanks!

@browniebrokebrowniebroke removed this from the3.17 milestoneOct 29, 2025
@browniebroke
Copy link
Member

As this is a bit time sensitive, I've done it in#9810

Let's go back to this once it's merged. Thanks for your patience.

@auvipy
Copy link
Collaborator

lets wait until 3.18

@TGoddessana
Copy link
ContributorAuthor

I apologize for the delayed response. I've been personally busy and going through a difficult time.

Thank you for working on the package. As you suggested, I think it would be best to consider up to version 3.18.

As mentioned, I think the cleanest approach is to remove all schema-related code (packages, tests). It won't be easy to maintain the code without breaking the integration points for both packages (drf-spectacular, drf-yasg).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@auvipyauvipyAwaiting requested review from auvipy

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@TGoddessana@auvipy@browniebroke

[8]ページ先頭

©2009-2025 Movatter.jp