Husqvik / GraphQlClientGenerator

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

Fix nested lists of complex objects #127

Closed gao-artur closed 1 year ago

gao-artur commented 1 year ago

Consider the following schema:

type Query {
  objectWithNestedListsField: ObjectWithNestedListsField!
}

type ObjectWithNestedListsField {
  nestedListOfComplexObjects: [[AnotherComplexObject]!]!
}

type AnotherComplexObject {
  justAString: String
}

Before the fix, it was generating a wrong method without complex object builder

public ObjectWithNestedListsFieldQueryBuilder WithNestedListOfComplexObjects(string alias = null, IncludeDirective include = null, SkipDirective skip = null)
{
    return WithScalarField("nestedListOfComplexObjects", alias, new GraphQlDirective[] { include, skip });
}

After the fix

public ObjectWithNestedListsFieldQueryBuilder WithNestedListOfComplexObjects(AnotherComplexQueryBuilder anotherComplexQueryBuilder, string alias = null, IncludeDirective include = null, SkipDirective skip = null)
{
    return WithObjectField("nestedListOfComplexObjects", alias, anotherComplexQueryBuilder, new GraphQlDirective[] { include, skip });
}