Search code examples
typescriptopenapiopenapi-generatoropenapi-generator-cli

Openapi Generator won't generate a readme.md file, but only for typescript-axios and typescript-fetch generators


I tried to generate a client like this:

openapi-generator generate -i path/to/api_spec/_build/api_name.yaml -g typescript-axios -o path/to/api_name_typescript_axios_client --package-name=api_name_typescript_axios_client --global-property=apiDocs=true

It generates the code fine, no validation errors but it doesn't generate a readme. I've never experienced this behavior with the c#, node or go clients before. I ran the validate cli command as well and no issues there. I also tried passing --global-property=apiDocs=true.

According to the docs, the readme feature is supported: https://openapi-generator.tech/docs/generators/typescript-axios#documentation-feature.


Solution

  • For some reason, it is not generated by default, until you specifically mention a npmName in a CLI command or in your config.yaml.

    To specify it via CLI, add a flag like this:

    --additional-properties=npmName=yourPackageName