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

Subclass SchemaGenerator instead of defining a new one #470

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

kevin-brown
Copy link

While the SchemaGenerator provided by DRF-YASG is not API-compatible with the one used by DRF, it does use a lot of the methods and even generates a DRF one internally. Given that this required quite a bit of extra code to be written to do the wrapping, it makes sense to instead just subclass it and get those additional benefits.

This should make it easier to migrate from the CoreAPISchemaGenerator, which is what is currently being used, to the DRF-provided OpenAPISchemaGenerator for the internal serialization. That was not done here because there is still a lot of work that needs to be done in order to enable that.

While the SchemaGenerator provided by DRF-YASG is not API-compatible
with the one used by DRF, it does use a lot of the methods and even
generates a DRF one internally. Given that this required quite a
bit of extra code to be written to do the wrapping, it makes sense
to instead just subclass it and get those additional benefits.

This should make it eaiser to migrate from the CoreAPISchemaGenerator,
which is what is currently being used, to the DRF-provided
OpenAPISchemaGenerator for the internal serialization. That was not
done here because there is still a lot of work that needs to be done
in order to enable that.
Copy link
Contributor

@PaulWay PaulWay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea.

@kevin-brown kevin-brown force-pushed the GH-461-schemagenerator-subclass branch from 1e013f0 to 1920a81 Compare December 4, 2019 00:33
@JoelLefkowitz JoelLefkowitz changed the base branch from master to 1.21.x July 17, 2022 17:20
@JoelLefkowitz JoelLefkowitz added 1.21.x Release target in 1.21.x enhancement labels Jul 17, 2022
@JoelLefkowitz JoelLefkowitz added 1.22.x Release target in 1.22.x and removed 1.21.x Release target in 1.21.x labels Jul 17, 2022
@JoelLefkowitz JoelLefkowitz deleted the branch axnsan12:master October 17, 2024 11:55
@JoelLefkowitz JoelLefkowitz reopened this Oct 17, 2024
@JoelLefkowitz JoelLefkowitz changed the base branch from 1.21.x to master October 17, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.22.x Release target in 1.22.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants