Redfish-Tools icon indicating copy to clipboard operation
Redfish-Tools copied to clipboard

Syntax error in OpenApi.yaml hosted at http://redfish.dmtf.org/schemas/v1/openapi.yaml

Open cfeilen opened this issue 5 years ago • 2 comments

Not sure this is the right place for this, but it seems active, so please feel free to move to a different repro, or let me know a better place for this... I am completely new to YAML and the OpenAPI space right now. I've tried a few different OData and Openapi generators, but so far none of them have been able to fully parse the data hosted on http://redfish.dmtf.org/schemas/v1/.
Currently I am using VS2019 with the 'Unchase OpenAPI (Swagger API) Connected Service' pluggin to generate some C# client classes for accessing a rack of servers which use the Redfish api.

When I load http://redfish.dmtf.org/schemas/v1/openapi.yaml, the tool throws an error that the ? character is unexpected:
Error: Invalid property identifier character: ?. Path 'paths['/redfish/v1/AccountService/ExternalAccountProviders/{ExternalAccountProviderId}/Certificates/{CertificateId}']', line 1, position 31085

So, my question is.... Is the ? on line 986 actually valid YAML?
? /redfish/v1/AccountService/ExternalAccountProviders/{ExternalAccountProviderId}/Certificates/{CertificateId}/Actions/Certificate.Rekey : post: parameters:

cfeilen avatar Mar 19 '20 23:03 cfeilen

Moved to Redfish-Tools since this is the repo that contains the JSON Schema to OpenAPI converter.

mraineri avatar Mar 20 '20 00:03 mraineri

The short answer is, yes, that is valid YAML. YAML defines usage of ? for complex mappings.

However, the more complex thing about this is why is it even generated that way in the first place. As far as I can tell, the Python yaml module seems to do this when a line in the output will go more than a certain length. We haven't had issues with this in the past; when using the same module to read a YAML file, it's able to properly put it into a Python dictionary:

    with open( "openapi.yaml" ) as openapi_file:
        openapi_data = yaml.load( openapi_file, Loader = yaml.FullLoader )

The same file has been used on some of the tools used in the OpenAPI community (like Swagger Editor).

I'm not aware of anyone trying this out with the module you're referencing though.

mraineri avatar Mar 20 '20 00:03 mraineri