Fixes: #20670: Related Object Validation #944

Closed
opened 2026-04-05 19:05:38 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @m-hau on 10/30/2025

Fixes: #20670

Explicitly check that any related object field is a list, and that each related object is a dictionary, and trigger a validation error if this is not the case. This prevents these cases to result in a hard internal error to occur.

While testing I also found three other minor issues in the same code area, which I took the liberty to fix as well:

  • Related objects are no longer indexed by 0 in the validation errors, but now from 1 like the top-level objects ("records")
  • Related object validation errors now show the correct top-level object ("record") index
  • Change the "Object with ID x does not exist" error to use the same format and channel as all other validation errors

Please see the individual commit messages for more detailed information on each individual change.

*Originally created by @m-hau on 10/30/2025* <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #20670 Explicitly check that any related object field is a list, and that each related object is a dictionary, and trigger a validation error if this is not the case. This prevents these cases to result in a hard internal error to occur. While testing I also found three other minor issues in the same code area, which I took the liberty to fix as well: - Related objects are no longer indexed by 0 in the validation errors, but now from 1 like the top-level objects ("records") - Related object validation errors now show the correct top-level object ("record") index - Change the "Object with ID x does not exist" error to use the same format and channel as all other validation errors Please see the individual commit messages for more detailed information on each individual change.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#944