[PR #20991] [MERGED] Closes: #20930 - Add an ASNSiteSerializer to allow serialization of Site in ASNSerializer #16108

Closed
opened 2025-12-30 00:25:50 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20991
Author: @bctiemann
Created: 12/16/2025
Status: Merged
Merged: 12/17/2025
Merged by: @arthanson

Base: featureHead: 20930-asn-site-serializer


📝 Commits (2)

  • d3f1e4a Add an ASNSiteSerializer to allow serialization of Site in ASNSerializer
  • 4dafb1e Add to all

📊 Changes

1 file changed (+22 additions, -2 deletions)

View changed files

📝 netbox/ipam/api/serializers_/asns.py (+22 -2)

📄 Description

Closes: #20930

Normally, via the UI, it is possible to set the list of associated sites when creating an ASN. This is not possible currently in the API because ASNSerializer omits a sites field because of a circular import issue.

This PR resolves the circular import by creating a minimal ASNSiteSerializer for use in ASNSerializer, allowing a POST payload such as:

{
    "asn": 65007,
    "rir": 8,
    "sites": [24]
}

🔄 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/20991 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/17/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `feature` ← **Head:** `20930-asn-site-serializer` --- ### 📝 Commits (2) - [`d3f1e4a`](https://github.com/netbox-community/netbox/commit/d3f1e4a8bb74a08a426c64ac60dd9fac323f6952) Add an ASNSiteSerializer to allow serialization of Site in ASNSerializer - [`4dafb1e`](https://github.com/netbox-community/netbox/commit/4dafb1ebbc5c5cd0fe6812c2002dc7416223e445) Add to __all__ ### 📊 Changes **1 file changed** (+22 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/api/serializers_/asns.py` (+22 -2) </details> ### 📄 Description ### Closes: #20930 Normally, via the UI, it is possible to set the list of associated sites when creating an ASN. This is not possible currently in the API because `ASNSerializer` omits a `sites` field because of a circular import issue. This PR resolves the circular import by creating a minimal `ASNSiteSerializer` for use in `ASNSerializer`, allowing a POST payload such as: ``` { "asn": 65007, "rir": 8, "sites": [24] } ``` --- <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-30 00:25:50 +01:00
adam closed this issue 2025-12-30 00:25:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16108