🐛 OpenAPI schema for nested SamlConfig is incorrect
Netbox API version | RPS plugin version |
---|---|
3.6.9 | 0.12.0 |
Actual Behavior
In the OpenAPI schema, the field saml_config
in the Mapping
schema is not nullable.
This introduce a bug with the generated client (made with openapi-python-client
) in the RPS agent.
In the agent, we receive mappings (in JSON) via Netbox webhooks. When deserializing the JSON into a Mapping
object, it fails if the mapping has no saml_config
(the field is set to null
).
The generated client trusts the OpenAPI schema which do not indicate that this field is nullable.
Desired Behavior
The OpenAPI schema should define the saml_config
field in the Mapping
schema as nullable.
How to reproduce
Using the client:
from ec_netbox_openapi.models import Mapping
data = dict(
id=mapping_id,
url="mock://netbox/api/plugins/rps/mappings/1/",
created=None,
last_updated=None,
source="source url",
target="target url",
http_headers=[],
saml_config=None,
)
mapping = Mapping.from_dict(data) # raises because saml_config is None
NB: Once the fix is deployed, the client needs to be regenerated to reflect the latest changes.