API PATCH seems to re-validate from object name #8985

Closed
opened 2025-12-29 20:43:49 +01:00 by adam · 7 comments
Owner

Originally created by @CADbloke on GitHub (Dec 19, 2023).

Deployment Type

Self-hosted

NetBox Version

3.5.6

Python Version

3.8

Steps to Reproduce

Call API to add / update Custom fields

Netbox: "request  URL  : /dcim/devices/4761/"
Netbox: "request  JSON : {"custom_fields":{"system_name":"HUB Tx/RX1-10","diagram_id":"215020-1"}}"
Netbox: "response JSON : {"name":["'name' field must match regex '^[a-zA-Z0-9_\-. ]*$'"]}"

Expected Behavior

Update the field and return the updated object

Observed Behavior

Custom field system_name updates ok when the text validates with the regex mentioned in the error response.

Validation on the system_name Custom field was empty, I set it it .* with no effect, still returns an error

Originally created by @CADbloke on GitHub (Dec 19, 2023). ### Deployment Type Self-hosted ### NetBox Version 3.5.6 ### Python Version 3.8 ### Steps to Reproduce Call API to add / update Custom fields ```` Netbox: "request URL : /dcim/devices/4761/" Netbox: "request JSON : {"custom_fields":{"system_name":"HUB Tx/RX1-10","diagram_id":"215020-1"}}" Netbox: "response JSON : {"name":["'name' field must match regex '^[a-zA-Z0-9_\-. ]*$'"]}" ```` ### Expected Behavior Update the field and return the updated object ### Observed Behavior Custom field `system_name` updates ok when the text validates with the regex mentioned in the error response. Validation on the `system_name` Custom field was empty, I set it it `.*` with no effect, still returns an error
adam added the type: bugstatus: revisions needed labels 2025-12-29 20:43:49 +01:00
adam closed this issue 2025-12-29 20:43:49 +01:00
Author
Owner

@CADbloke commented on GitHub (Dec 19, 2023):

Actually, the Device does have a name that doesn't validate: "name": "HUB Tx/Rx1-10", is the Netbox Name too. I am not touching it with the API calls so I don't expect to trigger a validation. Don't know how it got there without validation.

@CADbloke commented on GitHub (Dec 19, 2023): Actually, the Device does have a name that doesn't validate: `"name": "HUB Tx/Rx1-10",` is the Netbox Name too. I am not touching it with the API calls so I don't expect to trigger a validation. Don't know how it got there without validation.
Author
Owner

@CADbloke commented on GitHub (Dec 19, 2023):

Edited the title - this had nothing to do with Custom Fields - any PATCH call seem to revalidate the name. That's not what I asked for.

@CADbloke commented on GitHub (Dec 19, 2023): Edited the title - this had nothing to do with Custom Fields - any PATCH call seem to revalidate the name. That's not what I asked for.
Author
Owner

@jeffgdotorg commented on GitHub (Dec 19, 2023):

Thanks for the report; we need a little more help from you in a couple of areas before we're able to move forward.

First, the version you're reporting against is a full minor rev behind the current release (3.6.7). We've fixed a lot of bugs since then, so please attempt to reproduce the problem in a more current version and let us know how that turns out.

Second, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. A series of curl commands would be ideal for this particular issue.

@jeffgdotorg commented on GitHub (Dec 19, 2023): Thanks for the report; we need a little more help from you in a couple of areas before we're able to move forward. First, the version you're reporting against is a full minor rev behind the current release (3.6.7). We've fixed a lot of bugs since then, so please attempt to reproduce the problem in a more current version and let us know how that turns out. Second, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. A series of `curl` commands would be ideal for this particular issue.
Author
Owner

@CADbloke commented on GitHub (Dec 20, 2023):

the version you're reporting against is a full minor rev behind the current release (3.6.7). We've fixed a lot of bugs since then, so please attempt to reproduce the problem in a more current version and let us know how that turns out.

Reasonable. I think we have a Dev instance that is more current. I'll try it

someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. A series of curl commands would be ideal for this particular issue.

Unreasonable. I'm a busy-as-everyone-else end-user editing an object via the API. That's a re-install Windows answer.

It looks like it is re-validating the Name of the Device even though I didn't touch the Name Property with the API. I'd also assume the validation in later versions will not allow me to create the invalid name so it's an impossible exercise.

If you have any suggestions on how I'm able to debug what's going on I'll speak with the admin & try it out.

@CADbloke commented on GitHub (Dec 20, 2023): > the version you're reporting against is a full minor rev behind the current release (3.6.7). We've fixed a lot of bugs since then, so please attempt to reproduce the problem in a more current version and let us know how that turns out. Reasonable. I think we have a Dev instance that is more current. I'll try it > someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. A series of curl commands would be ideal for this particular issue. Unreasonable. I'm a busy-as-everyone-else end-user editing an object via the API. That's a `re-install Windows` answer. It looks like it is re-validating the `Name` of the Device even though I didn't touch the `Name` Property with the API. I'd also assume the validation in later versions will not allow me to create the invalid name so it's an impossible exercise. If you have any suggestions on how I'm able to debug what's going on I'll speak with the admin & try it out.
Author
Owner

@jeremystretch commented on GitHub (Dec 20, 2023):

Unreasonable. I'm a busy-as-everyone-else end-user editing an object via the API. That's a re-install Windows answer.

No, it isn't. Per the bug report template:

Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly.

This information is required for someone else to reproduce the reported behavior. If you're unable or unwilling to provide these details, the issue will be closed with the assumption that the error is on your end.

@jeremystretch commented on GitHub (Dec 20, 2023): > Unreasonable. I'm a busy-as-everyone-else end-user editing an object via the API. That's a re-install Windows answer. No, it isn't. Per the bug report template: > Describe in detail the exact steps **that someone else can take to reproduce this bug** using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. This information is required for someone else to reproduce the reported behavior. If you're unable or unwilling to provide these details, the issue will be closed with the assumption that the error is on your end.
Author
Owner

@DanSheps commented on GitHub (Dec 20, 2023):

In addition to requiring it to actually reproduce the error, we also require it so that we can:

  • Verify the fix
  • Build tests into the system to prevent regression

The reason reproduction is important is there are some bugs which are only bugs under certain circumstances. There is also the possibility that a bug is introduced due to bad/poor editing of data (example: using the python API to work directly with the models and simply call save() instead of clean() and then save())

@DanSheps commented on GitHub (Dec 20, 2023): In addition to requiring it to actually reproduce the error, we also require it so that we can: * Verify the fix * Build tests into the system to prevent regression The reason reproduction is important is there are some bugs which are only bugs under certain circumstances. There is also the possibility that a bug is introduced due to bad/poor editing of data (example: using the python API to work directly with the models and simply call `save()` instead of `clean()` and then `save()`)
Author
Owner

@CADbloke commented on GitHub (Jan 23, 2024):

There is also the possibility that a bug is introduced due to bad/poor editing of data (example: using the python API to work directly with the models and simply call save() instead of clean() and then save())

the request / response is right there in the ticket. But if you want to make it impossible to contribute then so be it.

@CADbloke commented on GitHub (Jan 23, 2024): > There is also the possibility that a bug is introduced due to bad/poor editing of data (example: using the python API to work directly with the models and simply call save() instead of clean() and then save()) the request / response is right there in the ticket. But if you want to make it impossible to contribute then so be it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8985