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 Spec not matching observed behaviour for Interface Model #13792

Closed
mytlogos opened this issue Sep 17, 2023 · 3 comments
Closed

OpenAPI Spec not matching observed behaviour for Interface Model #13792

mytlogos opened this issue Sep 17, 2023 · 3 comments
Labels
pending closure Requires immediate attention to avoid being closed for inactivity severity: low Does not significantly disrupt application functionality, or a workaround is available status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation topic: OpenAPI type: bug A confirmed report of unexpected behavior in the application

Comments

@mytlogos
Copy link

NetBox version

v.3.6.1

Python version

3.8

Steps to Reproduce

  1. Create wlan
  2. Create device with wlan interface
  3. "Connect" wlan interface to wlan (Select wlan from edit form)
  4. request the interfaces endpoint (all or just one) (curl -v -s -H "Authorization: Token $TOKEN" http://netbox/api/dcim/interfaces/)

Expected Behavior

According to the OpenAPI spec, the Interface Model returns an array of integers.
See https://demo.netbox.dev/api/schema/swagger-ui/#/dcim/dcim_interfaces_list

Observed Behavior

The InterfaceSerializer returns the full objects instead of the expected wlan ids.

This is more useful as an api itself, but openapi generators which consume this api spec (e.g. https://github.com/OpenAPITools/openapi-generator/), generate wrong client implementations leading to unexpected behaviour.

In my case i used openapi generator to generate a golang client for netbox 3.6.1 (the official go-netbox client is still stuck at 3.4: netbox-community/go-netbox#157).
Assigning a wlan to an interface in netbox lead to golang unmarshalling an empty interface struct due to unexpected values in the response (a struct/object instead of integers), where it fails silently for some reason.

Unassigning the wlan from the interface "fixes" this bug.

@mytlogos mytlogos added the type: bug A confirmed report of unexpected behavior in the application label Sep 17, 2023
@abhi1693
Copy link
Member

I'd say the observed behaviour is the correct one if it returns the list of objects. We should rather fix the openapi specifications

@abhi1693 abhi1693 added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Sep 17, 2023
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Dec 18, 2023
Copy link
Contributor

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending closure Requires immediate attention to avoid being closed for inactivity severity: low Does not significantly disrupt application functionality, or a workaround is available status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation topic: OpenAPI type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants