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

feat: rename types in config #171

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

SanderVanRiessen
Copy link
Contributor

This merge request gives you the ability to rename your types, for example if you have conflicts in type names you can use the as NEWTYPENAME to work around the type name conflict.

@ardeois
Copy link
Owner

ardeois commented Sep 16, 2024

@SanderVanRiessen Could you explain why you would need such an option?
Typescript plugin doesn't have an option like this and we try to stay close to their configs.

@SanderVanRiessen
Copy link
Contributor Author

I have a use case where I have a Partial type in my schema, so in the current setup it conflicts with the Partial type of Typescript when generating the mocks.

@ardeois
Copy link
Owner

ardeois commented Sep 17, 2024

@SanderVanRiessen How is the typescript generator doing in such case? It's generating a Partial type as well no?

@SanderVanRiessen
Copy link
Contributor Author

Yes the typescript generator is creating a Partial type based on the schema. But it is not using the Partial type from Typescript in the generated file.

@ardeois
Copy link
Owner

ardeois commented Sep 19, 2024

Ok I understand now. It makes sense to have such an option but I've got the following comments:

  • I would prefer to use option typeNamesMapping instead of newTypeNames, please rename it
  • Update README to document the new option
  • Add unit tests

Thanks !

@SanderVanRiessen
Copy link
Contributor Author

Thanks for your comments.
I have updated the docs with the new option and added new tests, also renamed the option. Let me know if anything else needs to be changed.

Copy link
Owner

@ardeois ardeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes 👍

@ardeois ardeois self-assigned this Sep 20, 2024
@ardeois ardeois added the minor Increment the minor version when merged label Sep 20, 2024
@ardeois ardeois merged commit 2e03d68 into ardeois:main Sep 20, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants