openapi-typescript-codegen icon indicating copy to clipboard operation
openapi-typescript-codegen copied to clipboard

Add the ability to modify the syntax of the generated service method names

Open ghost opened this issue 2 years ago • 0 comments

Currently, all endpoints in my API are prefixed with /api, which results in the generated methods following the pattern <ServiceName>.<Method><EndpointURI> e.g. BookService.getApiBooks(). I propose introducing a feature that allows customization of this behavior.

Suggested Feature Implement a new CLI option: --stripEndpointPrefixFromMethodNames.

Example Usage openapi-generator-cli generate -i your-api-spec.yaml -g typescript --stripEndpointPrefixFromMethodNames "api"

This would generate the following code for endpoint /api/books

BookService.getBooks() instead of BookService.getApiBooks()

ghost avatar Nov 28 '23 14:11 ghost