pynetbox icon indicating copy to clipboard operation
pynetbox copied to clipboard

List of dictionaries as a field causes Record.save() error

Open MaayanPeleg opened this issue 1 year ago • 0 comments

pynetbox version

v7.3.3

NetBox version

V3.7.8

Python version

3.9

Steps to Reproduce

In a plugin model, create a JSON field that is set to a lost of dictionaries. For example: [{"example": "bug"}]

Expected Behavior

This field should be handles as a JSON list

Observed Behavior

Pynetbox on initialising the record from netbox, treats the list of dictionaries as references to objects in netbox, so each dictionary is initialised as records, when save is ran, it trys to get it's records id and raises an error as there is no id, as it's not a Record. The bug appears to be caused in _init_cache aswell as in _parse_values() in list_parser()

MaayanPeleg avatar Jun 26 '24 12:06 MaayanPeleg