Skip to content

OpenAPI Spec not matching observed behaviour for Interface Model #13792

@mytlogos

Description

@mytlogos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closureRequires immediate attention to avoid being closed for inactivityseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtopic: OpenAPItype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions