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 Mismatch: Controller returns null for roles property #141

Open
jan94 opened this issue Dec 12, 2024 · 0 comments
Open

OpenAPI Spec Mismatch: Controller returns null for roles property #141

jan94 opened this issue Dec 12, 2024 · 0 comments

Comments

@jan94
Copy link

jan94 commented Dec 12, 2024

Hi there :)

I am using the OpenAPI specification provided by OpenZiti for the OpenZiti Controller. It appears that the OpenAPI spec is not aligned with the actual behavior of the OpenZiti Controller. Specifically, the roles attribute defined under .definitions.roles in the OpenAPI spec is not marked as nullable.

definitions:
  roles:
      type: array
      items:
        type: string
      x-omitempty: false
      x-nullable: true  <-- missing

However, the OpenZiti Controllers' API returns null for the roles property (e.g. EdgeRouterPolicyDetail Model, specifically properties edge_router_roles & identity_roles) when querying router or service policies that do not have roles attached.

This discrepancy leads to an issue in my autogenerated client implementation (based on the OpenAPI spec), as the code attempts to validate the model data returned by the OpenZiti Controller. The returned object contains a null value for the roles attribute, causing validation errors.

Steps to Reproduce:

Use the OpenAPI spec to generate a client for the OpenZiti Controller using the openapi-generator-cli.
Create a service policy or router policy without specifying attributes or identities using the ZAC.
Perform a GET request on the API to query a router or service policies.
Observe that the roles attribute in the response is null.
Expected Behavior: The controller should return an empty array instead of null for the roles property. Alternatively, the roles attribute can be marked as nullable in the OpenAPI spec to align with the actual behavior of the OpenZiti Controller.

Actual Behavior: The roles attribute is not marked as nullable in the OpenAPI spec, leading to validation errors in the autogenerated client when the roles attribute is null.

Environment:

OpenZiti Controller version: 1.1.5 (additionally tested with version 1.1.15)
OpenAPI spec version: v0.26.20
Client code generator: openapi-generator-cli 7.10.0
Autogenerated client language: python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant