Netbox openapi schema is generating incorrect response types #9344

Closed
opened 2025-12-29 20:48:50 +01:00 by adam · 5 comments
Owner

Originally created by @deathbeam on GitHub (Mar 11, 2024).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v3.7.3

Python Version

3.9

Steps to Reproduce

  1. Check swagger for /api/dcim/sites
  2. Create some dummy site with random ASN
  3. Observe that swagger openapi schema tells that response for site.asns is supposed to be list of integers (e.g ids)
  4. Observe that actual rest response for site.asns is the asns objects themselves

image

image

Expected Behavior

Openapi schema and actual API response must always match otherwise the schema is basically unusable. The response and schema used to match in past (confirmed on 3.4.5 at least) so something broke since.

Observed Behavior

Schema and response do not match. Observed behaviour is for site.asns, configcontext.roles, configcontext.tenants, virtualizationinterface.tagged_vlans, but there are probably more.

Originally created by @deathbeam on GitHub (Mar 11, 2024). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v3.7.3 ### Python Version 3.9 ### Steps to Reproduce 1. Check swagger for /api/dcim/sites 2. Create some dummy site with random ASN 3. Observe that swagger openapi schema tells that response for site.asns is supposed to be list of integers (e.g ids) 4. Observe that actual rest response for site.asns is the asns objects themselves ![image](https://github.com/netbox-community/netbox/assets/5115805/d4fbb74b-c38f-4faa-a18e-0ad65fa481f5) ![image](https://github.com/netbox-community/netbox/assets/5115805/4d39aad6-34f8-4b6f-bc99-5dfe78204028) ### Expected Behavior Openapi schema and actual API response must always match otherwise the schema is basically unusable. The response and schema used to match in past (confirmed on 3.4.5 at least) so something broke since. ### Observed Behavior Schema and response do not match. Observed behaviour is for site.asns, configcontext.roles, configcontext.tenants, virtualizationinterface.tagged_vlans, but there are probably more.
adam added the type: bugstatus: acceptedseverity: lowtopic: OpenAPI labels 2025-12-29 20:48:50 +01:00
adam closed this issue 2025-12-29 20:48:50 +01:00
Author
Owner

@deathbeam commented on GitHub (Mar 12, 2024):

Is this really low severity? This breaks clients that use the openapi to generate/implement clients for netbox and its pretty big regression. We for example cannot upgrade to new Netbox without this feature working properly as we rely on openapi heavily.

@deathbeam commented on GitHub (Mar 12, 2024): Is this really low severity? This breaks clients that use the openapi to generate/implement clients for netbox and its pretty big regression. We for example cannot upgrade to new Netbox without this feature working properly as we rely on openapi heavily.
Author
Owner

@jeremystretch commented on GitHub (Mar 12, 2024):

Yes, it's considered low severity as only the schema is affected; the function of the API itself is not.

Of course, if this is pressing for you, you are more then welcome to submit a PR for it. Can I assign this to you?

@jeremystretch commented on GitHub (Mar 12, 2024): Yes, it's considered low severity as only the schema is affected; the function of the API itself is not. Of course, if this is pressing for you, you are more then welcome to submit a PR for it. Can I assign this to you?
Author
Owner

@deathbeam commented on GitHub (Mar 12, 2024):

Yes, it's considered low severity as only the schema is affected; the function of the API itself is not.

Of course, if this is pressing for you, you are more then welcome to submit a PR for it. Can I assign this to you?

Alright. For now we are not upgrading past 3.5.0, if I will have some time I will look at it, but can't make any promises so probs dont assign it to me (in case someone that might know what caused this would want to look at this like @arthanson as I assume this PR caused the incorrect behavior: https://github.com/netbox-community/netbox/pull/11626)

@deathbeam commented on GitHub (Mar 12, 2024): > Yes, it's considered low severity as only the schema is affected; the function of the API itself is not. > > Of course, if this is pressing for you, you are more then welcome to submit a PR for it. Can I assign this to you? Alright. For now we are not upgrading past 3.5.0, if I will have some time I will look at it, but can't make any promises so probs dont assign it to me (in case someone that might know what caused this would want to look at this like @arthanson as I assume this PR caused the incorrect behavior: https://github.com/netbox-community/netbox/pull/11626)
Author
Owner

@olekgo commented on GitHub (Apr 9, 2024):

Interface.TaggedVlans is another one

@olekgo commented on GitHub (Apr 9, 2024): Interface.TaggedVlans is another one
Author
Owner

@deathbeam commented on GitHub (Jun 21, 2024):

Looks like this is now mostly resolved

EDIT:

But here is related issue that also needs to be solved for the schema to be correct: https://github.com/netbox-community/netbox/issues/16670

@deathbeam commented on GitHub (Jun 21, 2024): Looks like this is now mostly resolved EDIT: But here is related issue that also needs to be solved for the schema to be correct: https://github.com/netbox-community/netbox/issues/16670
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9344