-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JSON custom fields #2196
Comments
Hi, I've been thinking about migrating to netbox, but the tooling we use relies on JSON custom fields. I've been following the discussion on #1349 but as far as I could understand it has a different scope. In our case, we'd rather merge the context ourselves. Besides, some fields do not directly relate to configuration information, so we just need a placeholder for the json data and the ability to index and query it efficiently. I'm very new to netbox and I found it amazing to see this early implementation. Btw, what if instead of serialized_value we had a json_value to unify the custom field representation?
|
Custom fields are not intended to store large amounts of data. Values are limited to 255 characters. #1349 will introduce config contexts in v2.4, which will support arbitrary data in JSON formats applied to a set of device/VMs (categorized by site, role, etc.). However, the attachment of arbitrary free-form data to individual objects is out of scope for NetBox. |
Issue type
[x] Feature request
[ ] Bug report
[ ] Documentation
Environment
Description
To integrate Netbox with external systems more reliably, we would like to be able to store JSON structured data against objects with custom fields.
For our use case this is to support marking up our devices, IPs and networks which additional data to support custom tooling and to match metadata which maps to other systems.
To implement this, the proposal would be to add a "structured_data" field to the CustomFieldValue model, and a new
CF_TYPE_JSON
type for custom fields. CustomField's with JSON data would return thestructured_data
value rather then a deserialized value, which in the underlying database would be stored as a postgres JSONB type via the Django postgres JSON field.To support data consistency, two additional fields for the CustomField would be added -
json_schema
as JSON andvalidate_json
(a bool) to allow enforcing the structure of added JSON and using thedjango-jsonforms
module to generate rich user frontends for custom fields in the UI.django-json-widget
can be used to support free editing of schemas in the admin interface.An early version of this proposal is already implemented here: https://github.com/wrouesnel/netbox/tree/json_custom_fields, the django-jsonforms requires some CSS work to fit nicely into the UI.
The text was updated successfully, but these errors were encountered: