Husqvik / GraphQlClientGenerator

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

Skip generation of base classes. #143

Closed rfriend-zilo closed 1 year ago

rfriend-zilo commented 1 year ago

I would like to separate out the base classes, such as GraphQlQueryParameter. Because I would like to create some extension methods I can package up and reuse across multiple client libraries within our organization that follow standard paradigms for things like sorting, paging, filtering etc..

For example, I would do something like this in my shared lib

public static TBuilder WithOffsetPaging<T>(this T builder, OffsetPaging paging)
    where T : GraphQlQueryBuilder
{
    return builder
        .WithParameter(new GraphQlQueryParameter<int>(KnownGraphParams.Skip, GraphQlTypes.Int, paging.GetSkipValue()))
        .WithParameter(new GraphQlQueryParameter<int>(KnownGraphParams.Take, GraphQlTypes.Int, paging.GetTakeValue()));
}

But I've no way to centralize the base classes into my library, and have the generated code use those instead of repeating them in each client library - any suggestions?

Husqvik commented 1 year ago

How did you resolve the issue?