0

I am trying to generate server code using openapitools/openapi-generator-cli which I installed globally using NPM.

When I run the command: openapi-generator generate -i MyApi.yaml -g aspnetcore -o ./src

I get the following error:

[main] 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')

I have also tried converting my spec file to json and encountered the same error.

How can I resolve this error with parsing the yaml file?

1 Answer 1

1

I ran my spec file through the online editor at http://editor.swagger.io/ and found an error in my yaml (I forgot to add a parameter entry for a path with a parameter in the path). Once I fixed the error, the generator worked correctly.

So this was user error, though the error message could be better.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.