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

Add support for OpenAPI additionalProperties #32

Closed
isc-tstolker opened this issue Oct 18, 2023 · 2 comments
Closed

Add support for OpenAPI additionalProperties #32

isc-tstolker opened this issue Oct 18, 2023 · 2 comments

Comments

@isc-tstolker
Copy link
Collaborator

isc-tstolker commented Oct 18, 2023

The API I try to call has the following definition:

      "CheckHealthResponse":{
        "required":[
          "details",
          "status"
        ],
        "properties":{
          "status":{
            "type":"string",
            "description":"Overall status derived from performed health checks. Values are \"UP\", \"DOWN\" and \"UNKNOWN\"."
          },
          "details":{
            "type":"object",
            "additionalProperties":{
              "$ref":"#/components/schemas/HealthCheckResult"
            },
            "description":"Map of the performed health checks and their results."
          }
        }
      },
      "HealthCheckResult":{
        "required":[
          "status"
        ],
        "properties":{
          "status":{
            "type":"string",
            "description":"Status of the health check. Values are \"UP\", \"DOWN\" and \"UNKNOWN\"."
          },
          "details":{
            "description":"Details of the health check result."
          }
        }
      }

A typical response that matches this is:

{
    "status": "UP",
    "details": {
        "crypto.filesystem": {
            "status": "UP"
        },
        "network.auth_config": {
            "status": "UP",
            "details": "no node DID"
        },
        "pki.crl": {
            "status": "UP"
        }
    }
}

So additionalProperties can be translated to a list of objects that each have a name and the object that is in de definition.
This part is currently missing in the model generation and not populated in the LoadFromResponse() method

@isc-tstolker
Copy link
Collaborator Author

I was able to fix this in my custom code by defining the details Property as Array of HealthCheckResult.
I plan to submit a PR for that

/// Map of the performed health checks and their results.
/// * This property is required.
Property details As array Of Nuts.Api.Monitoring.model.HealthCheckResult;

@isc-tstolker
Copy link
Collaborator Author

Has been fixed now

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