Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

feat(prefix): with naming_scheme: simple #348

Open
jjangga0214 opened this issue Aug 21, 2021 · 2 comments
Open

feat(prefix): with naming_scheme: simple #348

jjangga0214 opened this issue Aug 21, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@jjangga0214
Copy link

jjangga0214 commented Aug 21, 2021

Hi!

Thank you for this great package!

Sometimes, user-defined dart type and generated code result in naming conflict.
I understand to use naming_scheme: pathedWithTypes for those cases.
However, people can still want to use naming_scheme: simple, in some cases.

For them, a concept of prefix would be very helpful.
For instance, graphql-code-generator(npm) does support this feature.
https://www.graphql-code-generator.com/docs/plugins/typescript

Screenshot from 2021-08-21 18-31-07

So, if I set it to Gql for example, types are generated like as, GqlFoo or GqlBar, not Foo or Bar.

How do you think?

Thanks :)

@jjangga0214 jjangga0214 added the bug Something isn't working label Aug 21, 2021
@vasilich6107
Copy link
Collaborator

@jjangga0214 as you see from your screenshot those prefix applied to all types so instead two equal types ProductDetails you will get two equal types GqlProductDetails

@vasilich6107 vasilich6107 added enhancement New feature or request and removed bug Something isn't working labels Aug 24, 2021
@jjangga0214
Copy link
Author

jjangga0214 commented Aug 26, 2021

@vasilich6107

I don't understand what you meant here.

you will get two equal types GqlProductDetails

I guess what I meant by Sometimes, user-defined dart type and generated code result in naming conflict. is different from your understanding.

For example, let's say my graphql schema has ProductDetails type. Then Artemis generates the the type ProductDetails in dart, with naming_scheme: simple. However, I may still want to create (by myself) a type ProductDetails as a domain type, which might have related functions I want to define. If so, a naming conflict occurs.

So, what I meant by user-defined dart type is irrelevant from Artemis.

Of course, if names conflict, we can use as keyward when importing.
However, the point of this issue is that Artemis might become more flexible if prefix option is supported.

By the way, what was your original meaning?

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

No branches or pull requests

2 participants