Open danielkcz opened 4 years ago
So I decided to have a stab at this since it's starting to annoy me.
First thing, I noticed there is an explicit test to ignore typesPrefix
. Why is that? Is that some opinion that it "looks ugly"? That certainly shouldn't be like that. If configured, it should be respected no matter what.
Same for components...
So what is the stance here? Changing this here is technically a breaking change if someone uses typesPrefix
for something else.
@dotansimha So what about the typesPrefix
? Do you have some answer to that, please? The issue got closed accidentally with the PR.
Thanks, @FredyC , let's keep this open until we'll have a complete solution.
@dotansimha Solution is simple, but I need someone to decide what is the "correct behavior". Apparently, it was intended to ignore typesPrefix
for some reason.
same issue with the plugin typescript-msw
, it doesnt respect/acknolwedge omitOperationSuffix
, even though the class its extending from class MSWVisitor extends visitorPluginCommon.ClientSideBaseVisitor
has it listed as a config option. Was able to add it back manually but thats going to be a pain to manage a "custom" plugin that is fixed
Describe the bug I am used to prefixing my operations with
Q/M/S/F
so I opted enabled optionomitOperationSuffix
. Unfortunately, the urql plugin doesn't consider that and uses wrong type names., Also for a reason, I like to prefix types withT
which is ignored by plugin as well.https://github.com/dotansimha/graphql-code-generator/blob/db1db14ad43bdd876b4eab053d41b074b872359c/packages/plugins/typescript/urql/src/visitor.ts#L87
To Reproduce Steps to reproduce the behavior:
I tried to reproduce in codesandbox, but it's giving me weird errors: https://codesandbox.io/s/affectionate-montalcini-zcpsv?file=/codegen.yml
codegen.yml
config file:Expected behavior
The emitted types should not use operation type suffix when
omitOperationSuffix
is enabled. AndtypesPrefix
should be respected.