-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Device
in REST API doesn't include DeviceType.device_count
as described in Swagger schema
#16418
Comments
I'm seeing similar behavior for the
Return:
Expected schema (from https://hostname/api/schema/swagger-ui/#/ipam/ipam_prefixes_list):
Causes issues with strongly typed SDKs like the When calling
|
Thanks for reporting a problem you've encountered in NetBox. Do I understand correctly that you expect to see If so, please update the issue body to clarify the reason for your expectation. As a person who's only somewhat familiar with OpenAPI, understanding why this is a problem took me quite some time. |
main trouble is in inconsistency Swagger schema and real API responses - I don't need property "device_count" in "device_type" => change in Swagger definition, where "device_type" is type of "NestedDeviceType" is fine and fix this bug |
Thanks for clarifying the practical impact. I've adapted your previous comment and included it at the bottom of the issue body. |
Device
in REST API doesn't return DeviceType.device_count
as described in Swagger schema
Device
in REST API doesn't return DeviceType.device_count
as described in Swagger schemaDevice
in REST API doesn't include DeviceType.device_count
as described in Swagger schema
I just spotted #16085 which captures the same underlying problem as this issue. Resolving this one as a duplicate. |
Duplicate of #16085 |
Deployment Type
Self-hosted
NetBox Version
v4.0.3
Python Version
3.11
Steps to Reproduce
Expected Behavior
return:
Observed Behavior
return:
Narrative (from comments below, edited somewhat for clarity)
The main trouble is that there's an inconsistency between the Swagger schema and the actual API responses. The actual response fails to validate against the example schema provided by Swagger. This causes problems when using strongly-typed API client frameworks to generate code that talks to NetBox.
I don't need the property
device_count
as a child ofdevice_type
. A change in the Swagger definition, declaringdevice_type
to be of typeNestedDeviceType
is fine and will fix this bug for my purposes.The text was updated successfully, but these errors were encountered: