DEV Community

Possawat Sanorkam
Possawat Sanorkam

Posted on

Generating TypeScript APIs with OpenAPI Generator and Keeping Attribute Names Unchanged

To generate the API in TypeScript with the attribute name's first letter not capitalized, you can use the --model-name-prefix option in the openapi-generator-cli command. This will allow you to specify a prefix that will be added to the beginning of all generated model names. For example:

openapi-generator-cli generate -i /path/to/spec.yaml -g typescript-fetch -o /output/directory --model-name-prefix=''
Enter fullscreen mode Exit fullscreen mode

This will generate the TypeScript API in the specified output directory, and the attribute names in the generated models will have the first letter not capitalized.

Top comments (0)