[PR #4850] [MERGED] #3240: Use correct serializer class for available-prefixes POST #12935

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/4850
Author: @glennmatthews
Created: 7/13/2020
Status: Merged
Merged: 7/15/2020
Merged by: @jeremystretch

Base: developHead: gfm-issue-3240


📝 Commits (1)

  • 087ad30 Use correct serializer class for available-prefixes POST. Fixes #3240

📊 Changes

1 file changed (+5 additions, -0 deletions)

View changed files

📝 netbox/ipam/api/views.py (+5 -0)

📄 Description

Fixes: #3240

The /ipam/prefixes/{id}/available-prefixes/ API endpoint is asymmetric in terms of what serializer it uses for GET (PrefixSerializer) versus POST (PrefixLengthSerializer). By adding an appropriate implementation of get_serializer_class we can reflect this asymmetry and ensure that the Swagger API docs are correctly generated:

image


🔄 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/4850 **Author:** [@glennmatthews](https://github.com/glennmatthews) **Created:** 7/13/2020 **Status:** ✅ Merged **Merged:** 7/15/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `gfm-issue-3240` --- ### 📝 Commits (1) - [`087ad30`](https://github.com/netbox-community/netbox/commit/087ad30d3cc02f8a8678414e48f6c58f93cc3015) Use correct serializer class for available-prefixes POST. Fixes #3240 ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/api/views.py` (+5 -0) </details> ### 📄 Description ### Fixes: #3240 The `/ipam/prefixes/{id}/available-prefixes/` API endpoint is asymmetric in terms of what serializer it uses for `GET` (`PrefixSerializer`) versus `POST` (`PrefixLengthSerializer`). By adding an appropriate implementation of `get_serializer_class` we can reflect this asymmetry and ensure that the Swagger API docs are correctly generated: ![image](https://user-images.githubusercontent.com/5603551/87347492-52163080-c521-11ea-8ce0-88c0ea18a875.png) --- <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:24:27 +01:00
adam closed this issue 2025-12-29 22:24:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12935