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

Fix definition of vid_ranges in VLANGroup so it shows up in the OpenAPI schema #18237

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

Conversation

mraerino
Copy link
Contributor

Fixes: #17488

The OpenAPI schema for vid_ranges cannot automatically be discovered by drf-spectacular since it's a custom serializer with no fields. Therefore we need to manually provide the OpenAPI schema for the type we expect to see in requests and responses.

On top of that there is a bug in drf-spectacular that required the workaround with the custom list class (tfranzel/drf-spectacular#1353).

@mraerino mraerino changed the title Fix OpenAPI schema for vid_ranges in VLANGroup so it shows up Fix OpenAPI schema for vid_ranges in VLANGroup so it shows up Dec 13, 2024
@mraerino mraerino changed the title Fix OpenAPI schema for vid_ranges in VLANGroup so it shows up Fix definition of vid_ranges in VLANGroup so it shows up in the OpenAPI schema Dec 13, 2024
@mraerino mraerino marked this pull request as ready for review December 13, 2024 21:25
@jeremystretch
Copy link
Member

@mraerino did you see the comment here regarding the use of extend_schema_field() on a serializer (versus a field)? I suspect a more prudent solution might be to rewrite IntegerRangeSerializer to use IntegerField, though I'm not sure of the specifics.

@mraerino
Copy link
Contributor Author

yeah i saw. i think this is likely a little bit more complex and i wanted to get this bug fix out quickly so people can use the API again.

I can look into improving this in another PR, if you're ok with that?

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.

New field vid_ranges on vlan-group missing in API
2 participants