Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PascalCase for type names, or interfaces instead of types in models #369

Closed
pawKer opened this issue Apr 12, 2024 · 4 comments · Fixed by #402
Closed

PascalCase for type names, or interfaces instead of types in models #369

pawKer opened this issue Apr 12, 2024 · 4 comments · Fixed by #402
Assignees
Labels
feature 🚀 New feature or request

Comments

@pawKer
Copy link

pawKer commented Apr 12, 2024

Description

Just a copy of this feature request from the openapi-typescript-codegen project

ferdikoomen/openapi-typescript-codegen#1893

I'm personally mostly interested in the option to change the naming to PascalCase.

Like in the title.
Is there an option to set, that will change the name of models from camelCase to PascalCase, and option that would set model to be declared as interfaces instead of types ?
By default we have types with camelCase names
image
I would like to get interfaces with PascalCase names.
image

@pawKer pawKer added the feature 🚀 New feature or request label Apr 12, 2024
@jordanshatford
Copy link
Collaborator

@pawKer the types are defined based on the naming of the model in your spec. If you use PascalCase there they will be PascalCase. If you use camelCase, they will be camelCase.

Cc: @mrlubos about the ability to choose interface vs types.

@pawKer
Copy link
Author

pawKer commented Apr 12, 2024

Thanks for the quick response @jordanshatford, I have noticed that but was hoping I can keep the spec as is and only modify the generated code.

@jordanshatford
Copy link
Collaborator

@pawKer sounds reasonable. I think if we added an option for this it would probably allow specifying snake_case, PascalCase or camelCase.

Let's see what @mrlubos thinks.

@mrlubos
Copy link
Member

mrlubos commented Apr 12, 2024

We could add this through optional objects, although I think we should set pascalcase for interfaces by default as that's the recommended TypeScript way. Which would in turn remove the need for this pull feature, but to avoid breaking output for others, we should offer camelcase too 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants