[PR #2300] [MERGED] Updated IPAddressInterfaceSerializer to subclass WritableNestedSerial… #12355

Closed
opened 2025-12-29 22:21:03 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/2300
Author: @explody
Created: 8/3/2018
Status: Merged
Merged: 8/3/2018
Merged by: @jeremystretch

Base: develop-2.4Head: fix_2299


📝 Commits (1)

  • aee01af Updated IPAddressInterfaceSerializer to subclass WritableNestedSerializer

📊 Changes

1 file changed (+3 additions, -3 deletions)

View changed files

📝 netbox/ipam/api/serializers.py (+3 -3)

📄 Description

…izer

Also added readonly args to device and virtual_machine attrs to prevent unnecessary validation

Fixes:

#2299

Per @jeremystretch recommendation, I changed IPAddressInterfaceSerializer to subclass the more modern WritableNestedSerializer. Considering WritableNestedSerializer takes only a PK for write ops, and because nested attrs for device and virtual_machine were still throwing validation errors after changing the parent class, I added read_only=True args to both. This fixed the validation and I confirmed that I could alternately PATCH an address with interface values of NULL or a PK successfully.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/2300 **Author:** [@explody](https://github.com/explody) **Created:** 8/3/2018 **Status:** ✅ Merged **Merged:** 8/3/2018 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.4` ← **Head:** `fix_2299` --- ### 📝 Commits (1) - [`aee01af`](https://github.com/netbox-community/netbox/commit/aee01af2a1d241d9b00b5c76238e9d116f20f521) Updated IPAddressInterfaceSerializer to subclass WritableNestedSerializer ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/api/serializers.py` (+3 -3) </details> ### 📄 Description …izer Also added readonly args to device and virtual_machine attrs to prevent unnecessary validation <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be opened for approval prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. Please indicate the relevant feature request or bug report below. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ACCEPTED BUG REPORT OR FEATURE REQUEST, IT WILL BE MARKED AS INVALID AND CLOSED. --> ### Fixes: #2299 <!-- Please include a summary of the proposed changes below. --> Per @jeremystretch recommendation, I changed IPAddressInterfaceSerializer to subclass the more modern WritableNestedSerializer. Considering WritableNestedSerializer takes only a PK for write ops, and because nested attrs for device and virtual_machine were still throwing validation errors after changing the parent class, I added `read_only=True` args to both. This fixed the validation and I confirmed that I could alternately PATCH an address with interface values of NULL or a PK successfully. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:21:03 +01:00
adam closed this issue 2025-12-29 22:21:03 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12355