[PR #20777] [MERGED] Fixes #20638: Document bulk create support in OpenAPI schema #16047

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20777
Author: @jnovinger
Created: 11/10/2025
Status: Merged
Merged: 11/24/2025
Merged by: @jeremystretch

Base: mainHead: 20638-openapi-schema-incorrect


📝 Commits (3)

  • 773d86d Fixes #20638: Document bulk create support in OpenAPI schema
  • cb6cbe2 Address PR feedback
  • 5f62aaf Remove unused bulk_create_enabled attr

📊 Changes

3 files changed (+3129 additions, -501 deletions)

View changed files

📝 contrib/openapi.json (+2985 -501)
📝 netbox/core/api/schema.py (+36 -0)
netbox/core/tests/test_openapi_schema.py (+108 -0)

📄 Description

Fixes: #20638

POST operations on NetBoxModelViewSet endpoints accept both single objects and arrays, but the schema only documented single objects. This prevented REST API client generators from producing correct code.

Add explicit bulk_create_enabled flag to NetBoxModelViewSet and update schema generation to emit oneOf for these endpoints.

FWIW, I don't believe the PUT issue reported is a bug. The schema seems to correctly document PUT as array-only. NetBox's PUT is a bulk operation by design. For single updates, use PATCH /api/model/{id}/.


🔄 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/20777 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 11/10/2025 **Status:** ✅ Merged **Merged:** 11/24/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `20638-openapi-schema-incorrect` --- ### 📝 Commits (3) - [`773d86d`](https://github.com/netbox-community/netbox/commit/773d86dd85a62eb9a02212cae46cd6f189752a6e) Fixes #20638: Document bulk create support in OpenAPI schema - [`cb6cbe2`](https://github.com/netbox-community/netbox/commit/cb6cbe214d19747022d42bc806d695d6ffcd6d3f) Address PR feedback - [`5f62aaf`](https://github.com/netbox-community/netbox/commit/5f62aaf4cfd7a8060342bfabc6188c1c67804e22) Remove unused bulk_create_enabled attr ### 📊 Changes **3 files changed** (+3129 additions, -501 deletions) <details> <summary>View changed files</summary> 📝 `contrib/openapi.json` (+2985 -501) 📝 `netbox/core/api/schema.py` (+36 -0) ➕ `netbox/core/tests/test_openapi_schema.py` (+108 -0) </details> ### 📄 Description ### Fixes: #20638 POST operations on `NetBoxModelViewSet` endpoints accept both single objects and arrays, but the schema only documented single objects. This prevented REST API client generators from producing correct code. Add explicit bulk_create_enabled flag to `NetBoxModelViewSet` and update schema generation to emit `oneOf` for these endpoints. FWIW, I don't believe the `PUT` issue reported is a bug. The schema seems to correctly document `PUT` as array-only. NetBox's PUT is a bulk operation by design. For single updates, use `PATCH /api/model/{id}/`. --- <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:30 +01:00
adam closed this issue 2025-12-30 00:25:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16047