Skip to content
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

OpenAPI Specs do not match API Endpoints - specifically around Nested Object Counts #17985

Closed
jasonbarbee opened this issue Nov 11, 2024 · 3 comments
Labels
status: duplicate This issue has already been raised type: bug A confirmed report of unexpected behavior in the application

Comments

@jasonbarbee
Copy link

jasonbarbee commented Nov 11, 2024

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.0.11

Python Version

3.11

Steps to Reproduce

Related Issues
#16670
#16085

To Replicate:

  1. Open Netbox Swagger
  2. Observe Schema for BriefManufacturer
  3. OpenAPI Specs define the response as including fields that are not included in the actual payload response
    devicetype_count
image
  1. Query API as shown below.

Expected Behavior

Expected Response according to Swagger / Specs
Includes devicetype_count
image

Observed Behavior

Actual Endpoint Response
(missing devicetype_count)
image

Impact: Generated OpenAPI Models use this schema, and fail to process data correctly, since that field is expected to exist.

Other Nested Models also observed as affected

This might be separate issues, but the other Github issues linked several together around nested serialization. If I'm beyond the scope, let me know and I can remove these from the issue report, but I felt it may be worth documenting that this is bigger than just a single model. It may be more than these below.

The root cause of this seems to affects other models:
BriefDeviceType

image

Query - /dcim/device-types/281/

Note the schema - devicetype_count

image

Note the missing devicetype_count field.

image

BriefDeviceRole

image

When it is returned as part of a Nested object, notice the missing count fields that should be on the schema.
image

@jasonbarbee jasonbarbee added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Nov 11, 2024
@jeremystretch
Copy link
Member

v4.0.11

I'm afraid we're no longer accepting bug reports for this release. Are you able to confirm that this happens on the current stable release of NetBox (v4.1.6)?

@jeremystretch jeremystretch added status: revisions needed This issue requires additional information to be actionable and removed status: needs triage This issue is awaiting triage by a maintainer labels Nov 12, 2024
@jasonbarbee
Copy link
Author

jasonbarbee commented Nov 12, 2024

Yes, it happens in 4.1.6 also.

I have taken additional screenshots from the latest Demo Netbox instance, 4.1.6, which show the same behavior in schema vs response.

/dcim/devices/${id}
Schema - Swagger / OpenAPI schema includes the devicetype_count field
image

Response - Payload is missing the devicetype_counts
image

The 2 BriefDeviceRole counts are defined in the schema
image

The 2 BriefDeviceRole counts are missing from the response object
image

@jeremystretch
Copy link
Member

This appears to be a duplicate of #17976.

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2024
@jeremystretch jeremystretch added status: duplicate This issue has already been raised and removed status: revisions needed This issue requires additional information to be actionable labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate This issue has already been raised type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants