[PR #13445] [MERGED] 11578 mark swagger available- apis to accept lists in post #14182

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/13445
Author: @arthanson
Created: 8/11/2023
Status: Merged
Merged: 8/11/2023
Merged by: @jeremystretch

Base: developHead: 11578-openapi


📝 Commits (2)

  • 67d3669 11578 change swagger for available-ips to accept lists
  • 2ea0506 11578 change swagger for available-xxx to accept lists

📊 Changes

1 file changed (+16 additions, -4 deletions)

View changed files

📝 netbox/ipam/api/views.py (+16 -4)

📄 Description

Fixes: #11578

Marks the available APIs as returning a list. The technically correct fix would be using a PolymorphicProxySerializer as these can be called with a single object or a list, however this would cause the swagger to emit a "oneOf" which is not supported in Go OpenAPI generator, also it makes the spec more complex. If you only have to request a single item, just use a list with a single object as request so there really isn't a downside for this.

@jeremystretch I was mistaken, these only effect the availalbe-api's so there weren't that many to change.


🔄 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/13445 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 8/11/2023 **Status:** ✅ Merged **Merged:** 8/11/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `11578-openapi` --- ### 📝 Commits (2) - [`67d3669`](https://github.com/netbox-community/netbox/commit/67d3669f83b4095c2d6594b6d9d7b7f21c7d142e) 11578 change swagger for available-ips to accept lists - [`2ea0506`](https://github.com/netbox-community/netbox/commit/2ea05062992efe3a1512fc998972aed247cb373e) 11578 change swagger for available-xxx to accept lists ### 📊 Changes **1 file changed** (+16 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/api/views.py` (+16 -4) </details> ### 📄 Description ### Fixes: #11578 Marks the available APIs as returning a list. The technically correct fix would be using a PolymorphicProxySerializer as these can be called with a single object or a list, however this would cause the swagger to emit a "oneOf" which is not supported in Go OpenAPI generator, also it makes the spec more complex. If you only have to request a single item, just use a list with a single object as request so there really isn't a downside for this. @jeremystretch I was mistaken, these only effect the availalbe-api's so there weren't that many to change. --- <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:23:03 +01:00
adam closed this issue 2025-12-29 23:23: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#14182