Address warnings from generation of OpenAPI schema #11824

Open
opened 2025-12-29 21:50:19 +01:00 by adam · 5 comments
Owner

Originally created by @jeremystretch on GitHub (Nov 11, 2025).

Proposed Changes

After upgrading to drf-spectacular v0.29.0, generating the OpenAPI schema now yields several hundred warnings similar to those below:

netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag" in model. Defaulting to string.
netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag_id" in model. Defaulting to string.
netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tenant" in model. Defaulting to string.
netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag__n" in model. Defaulting to string.
netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag_id__n" in model. Defaulting to string.
netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tenant__n" in model. Defaulting to string.

Justification

These warnings likely indicate that the generated schema may not be accurate.

Originally created by @jeremystretch on GitHub (Nov 11, 2025). ### Proposed Changes After upgrading to `drf-spectacular` v0.29.0, generating the OpenAPI schema now yields several hundred warnings similar to those below: ``` netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag" in model. Defaulting to string. netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag_id" in model. Defaulting to string. netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tenant" in model. Defaulting to string. netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag__n" in model. Defaulting to string. netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag_id__n" in model. Defaulting to string. netbox/netbox/wireless/filtersets.py:90: Warning [WirelessLinkViewSet > WirelessLinkFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tenant__n" in model. Defaulting to string. ``` ### Justification These warnings likely indicate that the generated schema may not be accurate.
adam added the status: needs ownertype: housekeepingnetbox labels 2025-12-29 21:50:19 +01:00
Author
Owner

@Sachin-G07 commented on GitHub (Dec 9, 2025):

I am also getting a lot of warnings for netbox v4.4.7.

opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag" in model. Defaulting to string.
/opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag_id" in model. Defaulting to string.
/opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "site__n" in model. Defaulting to string.
/opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "location__n" in model. Defaulting to string.
/opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "rack__n" in model. Defaulting to string.
/opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "device__n" in model. Defaulting to string.
/opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "device_type__n" in model. Defaulting to string

Eventually, the server (k8s pod) stops responding and throws 503.

@Sachin-G07 commented on GitHub (Dec 9, 2025): I am also getting a lot of warnings for netbox v4.4.7. ``` opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag" in model. Defaulting to string. /opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "tag_id" in model. Defaulting to string. /opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "site__n" in model. Defaulting to string. /opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "location__n" in model. Defaulting to string. /opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "rack__n" in model. Defaulting to string. /opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "device__n" in model. Defaulting to string. /opt/netbox/netbox/dcim/filtersets.py: Warning [FrontPortViewSet > FrontPortFilterSet]: Unable to guess choice types from values, filter method's type hint or find "device_type__n" in model. Defaulting to string ``` Eventually, the server (k8s pod) stops responding and throws 503.
Author
Owner

@cjreyn commented on GitHub (Dec 9, 2025):

I'm also seeing the same

@cjreyn commented on GitHub (Dec 9, 2025): I'm also seeing the same
Author
Owner

@mkurjanski commented on GitHub (Dec 15, 2025):

We're also getting affected by this issue.

@mkurjanski commented on GitHub (Dec 15, 2025): We're also getting affected by this issue.
Author
Owner

@jeremystretch commented on GitHub (Dec 15, 2025):

@cjreyn @mkurjanski this issue is open for volunteers.

@jeremystretch commented on GitHub (Dec 15, 2025): @cjreyn @mkurjanski this issue is open for volunteers.
Author
Owner

@tom0010 commented on GitHub (Dec 18, 2025):

Looks to be related to this: https://github.com/tfranzel/drf-spectacular/issues/1475

@tom0010 commented on GitHub (Dec 18, 2025): Looks to be related to this: https://github.com/tfranzel/drf-spectacular/issues/1475
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11824