[PR #12285] [MERGED] 12278 add ipaddressfield serializer for OpenAPI spectacular typing #13942

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/12285
Author: @arthanson
Created: 4/18/2023
Status: Merged
Merged: 4/21/2023
Merged by: @jeremystretch

Base: featureHead: 12278-ipaddressfield-serialize


📝 Commits (10+)

  • 91e546c #12278 add serializer for ipaddressfield to remove spectacular warnings
  • fb1827c #12278 add ipaddressfieldserializer to nested serializers
  • 95e37e4 #12278 fix to_internal_value to_representation in serializer
  • 38f1b91 #12278 to_internal_value is called before validation! need to raise validation error if incorrect format
  • b967921 #12278 to_internal_value needs to return value doh
  • dc888e0 #12278 move IPAddressField to field_serializers
  • 1ea55d6 #12278 remove old import
  • 7923d18 Merge branch 'feature' into 12278-ipaddressfield-serialize
  • 7bdefbb Merge branch 'feature' into 12278-ipaddressfield-serialize
  • 762d9bd 12278 remove validator

📊 Changes

3 files changed (+40 additions, -0 deletions)

View changed files

netbox/ipam/api/field_serializers.py (+32 -0)
📝 netbox/ipam/api/nested_serializers.py (+4 -0)
📝 netbox/ipam/api/serializers.py (+4 -0)

📄 Description

Fixes: #12278

Creates a serializer for the IPAddressField so typing works correctly for OpenAPI eliminating warnings over the type (the default schema overrides weren't working for this). It's defined in nestedserializers due to scoping (serializers include nestedserializers).


🔄 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/12285 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 4/18/2023 **Status:** ✅ Merged **Merged:** 4/21/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `12278-ipaddressfield-serialize` --- ### 📝 Commits (10+) - [`91e546c`](https://github.com/netbox-community/netbox/commit/91e546c8001aba28c2e303393b36fa8fd8c280e2) #12278 add serializer for ipaddressfield to remove spectacular warnings - [`fb1827c`](https://github.com/netbox-community/netbox/commit/fb1827cac1c49c0d328b59d2e443d6bb35094f36) #12278 add ipaddressfieldserializer to nested serializers - [`95e37e4`](https://github.com/netbox-community/netbox/commit/95e37e47cc725108c119e248565d906ec23f561c) #12278 fix to_internal_value to_representation in serializer - [`38f1b91`](https://github.com/netbox-community/netbox/commit/38f1b919884d92a019a881b2a2e4830b0e570a4b) #12278 to_internal_value is called before validation! need to raise validation error if incorrect format - [`b967921`](https://github.com/netbox-community/netbox/commit/b96792179d539720d0d14ed434865ea7816ace63) #12278 to_internal_value needs to return value doh - [`dc888e0`](https://github.com/netbox-community/netbox/commit/dc888e0ac2264cacd1ea569244ea5a2d05d47982) #12278 move IPAddressField to field_serializers - [`1ea55d6`](https://github.com/netbox-community/netbox/commit/1ea55d6d56f1c373db8e89e91e8f194a69f15b91) #12278 remove old import - [`7923d18`](https://github.com/netbox-community/netbox/commit/7923d180eca5c3638ddd04307c2182c6a90ad70c) Merge branch 'feature' into 12278-ipaddressfield-serialize - [`7bdefbb`](https://github.com/netbox-community/netbox/commit/7bdefbb264f4402380f2bb5f8c28bf544e247867) Merge branch 'feature' into 12278-ipaddressfield-serialize - [`762d9bd`](https://github.com/netbox-community/netbox/commit/762d9bdbf6565d5218f3cb91e1f27a3e262223f6) 12278 remove validator ### 📊 Changes **3 files changed** (+40 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `netbox/ipam/api/field_serializers.py` (+32 -0) 📝 `netbox/ipam/api/nested_serializers.py` (+4 -0) 📝 `netbox/ipam/api/serializers.py` (+4 -0) </details> ### 📄 Description <!-- 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: #12278 <!-- Please include a summary of the proposed changes below. --> Creates a serializer for the IPAddressField so typing works correctly for OpenAPI eliminating warnings over the type (the default schema overrides weren't working for this). It's defined in nestedserializers due to scoping (serializers include nestedserializers). --- <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 23:21:40 +01:00
adam closed this issue 2025-12-29 23:21:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13942