Skip to content

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.

@bartvanandel
Copy link
Contributor

I'd be very interested in seeing this, or a similar approach, being merged as well. If this poses problems in the generic case, maybe it could be put behind a configuration flag. Either way, much appreciated!

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.

2 participants