You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Redfish openapi.yaml to generate a SDK (or documentation) both openap-generator-cli and swagger-codegen-cli are unable to parse a $ref schema reference inside 'x-patternProperties'. Pattern properties is a JSON schema construct that is not supported in the superset openapi schema and the "x-patternProperties" is a workaround that the generators do not fully support or recognize. Refer: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md#specification-extensions
As a result, the output of a generator looks like this snippet:
The reference is there, but it is not resolved and the target component schema is not included in the output. This breaks any generated code as the output schema is no longer compliant. The specification does not say that $ref is not supported, but the two most common generators have the same problem.
Here's what the snippet looks like in the published Redfish OpenAPI spec (Resource.yaml):
The text was updated successfully, but these errors were encountered:
Unfortunately OpenAPI doesn't support the "patternProperties" concept that JSON Schema has. There were some discussions about it a while ago, but I don't think anyone on the OpenAPI front is moving forward with that support.
Will need to spend some time thinking how to work around this in a manner that works well with OpenAPI tooling...
I don't think we should work around it as such. Maybe publish the workaround I described and spend resources on upgrading to OAS 3.1 which removes the problem. Although the JSON Schema would also have to be upgraded to 2020-12.
Tooling for OAS 3.1 is starting to ramp up, but as of today the two biggest stacks (OpenAPI and Swagger) don't have support for it, only commercial tools. In other words there's time.
Thanks for the info; I'll see if we really need to update our JSON Schema files to support 2020-12; if there's enough backwards compatibility, we might be able to keep them at the existing draft in the 8010 bundle and move our OpenAPI support to 3.1 (and swap out the usage of x-patternProperties.
When using the Redfish openapi.yaml to generate a SDK (or documentation) both openap-generator-cli and swagger-codegen-cli are unable to parse a $ref schema reference inside 'x-patternProperties'. Pattern properties is a JSON schema construct that is not supported in the superset openapi schema and the "x-patternProperties" is a workaround that the generators do not fully support or recognize. Refer: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md#specification-extensions
As a result, the output of a generator looks like this snippet:
The reference is there, but it is not resolved and the target component schema is not included in the output. This breaks any generated code as the output schema is no longer compliant. The specification does not say that $ref is not supported, but the two most common generators have the same problem.
Here's what the snippet looks like in the published Redfish OpenAPI spec (Resource.yaml):
The text was updated successfully, but these errors were encountered: