ardeois / graphql-codegen-typescript-mock-data

[GraphQL Codegen Plugin](https://github.com/dotansimha/graphql-code-generator) for building mock data based on the schema.
MIT License
133 stars 47 forks source link

Feat: Customized Prefixing #23

Closed 3nvi closed 4 years ago

3nvi commented 4 years ago

This PR simply provides an option for users to specify the prefix that their mock builders will have.

Closes #22

Additional Context

Initially I tried to implement the addPrefix option, but I saw that when omitting the prefix, the generator function names collided with the name of the existing TS types from @graphql-codegen/typescript. That's why a prefix must always be present.

This PR makes sure to fallback to the default prefix implementation even if the user manually specifies '' as a prefix just for this reason alone

3nvi commented 4 years ago

It would yeah, although I feel that the PR is just related to the bug itself, but to a new feature as well. In any case, I'm fully ok if you don't want to merge this due to the fact that it might make things more complex

ardeois commented 4 years ago

Well it seems like this PR includes the scalar changes as well, I think you have an issue with your branches. And yes to be honest, I would prefer to use indefinite instead of having custom prefix. But this is a personal opinion and I don't see why other developers might not decide differently. So I'm not against merging this, however I think you should make sure this PR only contains the changes for the prefix. The custom scalar should be a different branch and PR https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/21

3nvi commented 4 years ago

Well it seems like this PR includes the scalar changes as well, I think you have an issue with your branches. And yes to be honest, I would prefer to use indefinite instead of having custom prefix. But this is a personal opinion and I don't see why other developers might not decide differently. So I'm not against merging this, however I think you should make sure this PR only contains the changes for the prefix. The custom scalar should be a different branch and PR #21

Yeah you are right. I wanted to experiment a bit and I made a wrong merge. I'll clean all this up and start over

3nvi commented 4 years ago

Closing in favor of #25