graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

SDK: naming convention transform camelCase not working for inputTypes

Open abathellier opened this issue 6 years ago • 5 comments

When we use the new naming convention transform with the SDK to transform snake_case types in camelCase, renamed input fields are not well binded with their corresponding snake_case fields.

If we use:

transforms:
      - namingConvention:
          fieldNames: camelCase

the following query :

sdk.groupsQuery({ input: { perPage: 5 } });

return an error:

GraphQLError: Variable "$input" got invalid value { perPage: 1 }; Field "perPage" is not defined by type GroupsInput. Did you mean per_page or page?

if we use graphql-mesh serve it's working.

abathellier avatar Jun 10 '20 10:06 abathellier

@durdenx Could you share a reproduction on CodeSandbox or a GitHub repo?

ardatan avatar Jun 10 '20 16:06 ardatan

@ardatan You can find a reproduction here: https://github.com/durdenx/graphql-mesh-json-schema

abathellier avatar Jun 11 '20 10:06 abathellier

Available in https://github.com/Urigo/graphql-mesh/releases/tag/v0.2.11

ardatan avatar Jun 15 '20 16:06 ardatan

I've upgraded to v2.11 and the problem is still there : https://github.com/durdenx/graphql-mesh-json-schema

abathellier avatar Jun 17 '20 09:06 abathellier

It seems to be working fine since SDK is generated in a different way now. Let us know if the issue persists so we can reopen the issue.

ardatan avatar Mar 31 '23 05:03 ardatan