[PR #18237] [MERGED] Fix definition of vid_ranges in VLANGroup so it shows up in the OpenAPI schema #15296

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18237
Author: @mraerino
Created: 12/13/2024
Status: Merged
Merged: 2/26/2025
Merged by: @arthanson

Base: mainHead: feat/api-expose-vid-ranges


📝 Commits (2)

  • 6ba38dc Fix OpenAPI schema for vid_ranges in VLANGroup so it shows up
  • bd8be38 Refactor to use schema extension

📊 Changes

1 file changed (+19 additions, -1 deletions)

View changed files

📝 netbox/core/api/schema.py (+19 -1)

📄 Description

Fixes: https://github.com/netbox-community/netbox/issues/17488

The OpenAPI schema for vid_ranges cannot automatically be discovered by drf-spectacular since it's a custom serializer with no fields. Therefore we need to manually provide the OpenAPI schema for the type we expect to see in requests and responses.

On top of that there is a bug in drf-spectacular that required the workaround with the custom list class (https://github.com/tfranzel/drf-spectacular/issues/1353).


🔄 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/18237 **Author:** [@mraerino](https://github.com/mraerino) **Created:** 12/13/2024 **Status:** ✅ Merged **Merged:** 2/26/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `feat/api-expose-vid-ranges` --- ### 📝 Commits (2) - [`6ba38dc`](https://github.com/netbox-community/netbox/commit/6ba38dc26a9434d5fb128707c165fa26adb353a7) Fix OpenAPI schema for vid_ranges in VLANGroup so it shows up - [`bd8be38`](https://github.com/netbox-community/netbox/commit/bd8be383e4b735a5206c35a14a6e98f30b8210a4) Refactor to use schema extension ### 📊 Changes **1 file changed** (+19 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/core/api/schema.py` (+19 -1) </details> ### 📄 Description ### Fixes: https://github.com/netbox-community/netbox/issues/17488 The OpenAPI schema for `vid_ranges` cannot automatically be discovered by drf-spectacular since it's a custom serializer with no fields. Therefore we need to manually provide the OpenAPI schema for the type we expect to see in requests and responses. On top of that there is a bug in drf-spectacular that required the workaround with the custom list class (https://github.com/tfranzel/drf-spectacular/issues/1353). --- <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:21:08 +01:00
adam closed this issue 2025-12-30 00:21:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15296