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

Reference enums in path parameters #732

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrginglymus
Copy link

We're just switching to drf-spectacular from a heavily patched 'vanilla' drf schema generator, and it's great to see so many of the issues we'd fixed already fixed here.

This PR ensures that enums in paths also use the same reference as enums in schemas.

Where an enum is used in a path parameter that has already been
extracted from a model schema, use that reference in the path parameter
too.

This does not extract enums from path parameters to minimise complexity
of name resolution.
@mrginglymus
Copy link
Author

Ahh, I've just seen #520

I think these are valid concerns, and that's why I didn't also extract from path parameters. However, the key issue is that there is currently no easy way to hook the hook to reuse the logic in ones own code.

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 this pull request may close these issues.

None yet

1 participant