Open fabi125 opened 2 weeks ago
Self-hosted
v4.0.5
3.10
Device
parent_device
It should contain an annotation nullable: true.
nullable: true
It does not contain that annotation.
The fix for this should be to add allow_null=True to SerializerMethodField here: https://github.com/netbox-community/netbox/blob/c8aac13ceebf851368f6c7c2fbc6a783fc2e7bda/netbox/dcim/api/serializers_/devices.py#L60
allow_null=True
SerializerMethodField
Happy to put up a PR but it might be easier for a maintainer to just make the change and directly merge it.
Found a few more:
https://github.com/netbox-community/netbox/blob/c8aac13ceebf851368f6c7c2fbc6a783fc2e7bda/netbox/dcim/api/serializers_/base.py#L16-L17
and
https://github.com/netbox-community/netbox/blob/c8aac13ceebf851368f6c7c2fbc6a783fc2e7bda/netbox/dcim/api/serializers_/cables.py#L94
Thanks for looking at this :)
Thanks @fabi125, I've assigned this to you for a PR.
I've put up #16627 a while ago in case you missed it. Thanks!
Deployment Type
Self-hosted
NetBox Version
v4.0.5
Python Version
3.10
Steps to Reproduce
Device
Schema and look at theparent_device
fieldExpected Behavior
It should contain an annotation
nullable: true
.Observed Behavior
It does not contain that annotation.
The fix for this should be to add
allow_null=True
toSerializerMethodField
here: https://github.com/netbox-community/netbox/blob/c8aac13ceebf851368f6c7c2fbc6a783fc2e7bda/netbox/dcim/api/serializers_/devices.py#L60Happy to put up a PR but it might be easier for a maintainer to just make the change and directly merge it.