Husqvik / GraphQlClientGenerator

GraphQL C# client generator
MIT License
213 stars 49 forks source link

Invalid variable name in AddArgument for directive #110

Closed agenceplus-emillon closed 2 years ago

agenceplus-emillon commented 2 years ago

I have this code generated:

    public class AwsCognitoUserPoolsDirective : GraphQlDirective
    {
        public AwsCognitoUserPoolsDirective(QueryBuilderParameter<IEnumerable<string>> cognitoGroups = null) : base("aws_cognito_user_pools")
        {
            AddArgument("cognito_groups", cognito_groups);
        }
    }

It has generated cognito_groups instead of cognitoGroups.

graphql-client-generator --version
0.9.10
Husqvik commented 2 years ago

corresponds with https://aws.amazon.com/blogs/mobile/graphql-security-appsync-amplify/ cognito_groups is correct directive name

agenceplus-emillon commented 2 years ago

Yes, it's a correct directive name, but the code can't build because the parameter is "cognitoGroups". image

This should generate

AddArgument("cognito_groups", cognitoGroups);

or change the parameter name of

QueryBuilderParameter<IEnumerable<string>> cognitoGroups = null
Husqvik commented 2 years ago

sorry, I was mislead that the issue is in the generated GQL, not C#. New packages are uploaded now.

agenceplus-emillon commented 2 years ago

Thanks for your work, it's of great help. Sorry to have mislead you.

I will maybe make a fork to add the option to only generate data classes and enums.