Address warnings from generation of OpenAPI schema
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.
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.
I'm also seeing the same
We're also getting affected by this issue.
@cjreyn @mkurjanski this issue is open for volunteers.
Looks to be related to this: https://github.com/tfranzel/drf-spectacular/issues/1475