I would like to generate a typescript-fetch client using openapi-generator-cli. The specs were generated by Stoplight using OpenAPI 3.1 format. However when I run the command

openapi-generator-cli generate -i resources/openapi/Attribute.yaml -o ../test/ -g typescript-fetch

I get the error

[ERROR] i.s.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"openapi: 3.1.0 ... ] 

With another openapi code generator (openapi-typescript-codegen) I can generate client code without a problem so the specs are not only validated but usable. This makes suspect that the issue is with the OpenAPI version.

Is OpenAPI 3.1 supported by openapi-typescript-codegen or is there something I can do to adapt my specs file ?

I am using

  • openapi-generator-cli 5.4.0
  • OpenAPI 3.1
1

There are 1 answers

1
Beppe C On BEST ANSWER

OpenAPI 3.1 is yet not supported in Swagger and other tools, including openapi-generator-cli and that's the cause of the error.

Here is the last (significant) update, the team is still working on it.