Skip to content

Generating mutation models with ICollection instead of QueryBuilderParamter<ICollection<>> #168

@Isopolito

Description

@Isopolito

Is there a way to configure the generation process so that it will not add the QueryBuilderParameter code?

So instead of this:

  [JsonConverter(typeof (QueryBuilderParameterConverter<ICollection<BorrowerInput>>))]
    public QueryBuilderParameter<ICollection<BorrowerInput>?>? Borrowers
    {
      get => (QueryBuilderParameter<ICollection<BorrowerInput>>) this._borrowers.Value;
      set
      {
        this._borrowers = new InputPropertyInfo()
        {
          Name = "borrowers",
          Value = (object) value
        };
      }
    }

It would simply generate this:

ICollection<BorrowerInput>?>? Borrowers

For more context:

The requirement in my organization is to provide consumers of our API a GraphQL api client that has c# models included and allows them to pass in a string query and a variable collection and get a strongly typed response.

for instance

        var query = "....query text here...."
        var response = await client.QueryGraph(query, variables);

I'm using this library to generate the models included in the api client, and graphql-client library for the actual query/mutation logic.

It works great, but one of our consumers is trying to map their models to the mutation models generated by this library and they're having issues because on their end they have a ICollection, but the mutation models are wrapped in the QueryBuilderParameter logic.

Hopefully that makes sense...

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions