DEV Community

Possawat Sanorkam
Possawat Sanorkam

Posted on

1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more