Skip to content

The related_object_filter Isn't Displayed from custom_objects.custom_object_type_fields #751

@MrPaulAR

Description

@MrPaulAR

pynetbox version

7.6.1

NetBox version

v4.5.3-Docker-4.0.1 with netbox-custom-objects 0.4.6

Python version

3.12

Steps to Reproduce

If I use the API natively to query the endpoint @ /api/plugins/custom-objects/custom-object-type-fields/3/ I get the following body.

{
  "id": 3,
  "name": "cidr_list",
  "label": "CIDR List",
  "custom_object_type": 1,
  "description": "",
  "type": "multiobject",
  "primary": false,
  "required": true,
  "unique": false,
  "default": null,
  "choice_set": null,
  "validation_regex": "",
  "validation_minimum": null,
  "validation_maximum": null,
  "related_object_type": 84,
  "related_object_filter": {
    "vrf__n": "null",
    "tenant_group": "aws-accounts",
    "mask_length__lte": 28
  },
  "group_name": "",
  "search_weight": 500,
  "filter_logic": "loose",
  "ui_visible": "always",
  "ui_editable": "yes",
  "weight": 100,
  "is_cloneable": true,
  "comments": ""
}

However if I query the same endpoint via pynetbox the related_object_filter is not displayed

In [40]: nb.plugins.custom_objects.custom_object_type_fields.get(3).serialize()
Out[40]: 
{'id': 3,
 'name': 'cidr_list',
 'label': 'CIDR List',
 'custom_object_type': 1,
 'description': '',
 'type': 'multiobject',
 'primary': False,
 'required': True,
 'unique': False,
 'default': None,
 'choice_set': None,
 'validation_regex': '',
 'validation_minimum': None,
 'validation_maximum': None,
 'related_object_type': 84,
 'related_object_filter': '',
 'group_name': '',
 'search_weight': 500,
 'filter_logic': 'loose',
 'ui_visible': 'always',
 'ui_editable': 'yes',
 'weight': 100,
 'is_cloneable': True,
 'comments': ''}

In [41]: nb.plugins.custom_objects.custom_object_type_fields.get(3).related_object_filter
Out[41]: 

Expected Behavior

In pynetbox the related_object_filter should be a dictionary if it is defined by the api. Otherwise null.

Observed Behavior

The key related_object_filter is not populated from the returned data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    app: pynetboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions