Add "generic" option to the "optional" configuration for handling nullable types (#252)
This is an implementation for #251, it adds a new `"generic"` option for the `"optional"` configuration, and a companion type `"optional_generic_type"` which is a fully qualified type with a placeholder `%` for the generic parameter. Co-authored-by: Dylan R. Johnston <[email protected]> Co-authored-by: Ben Kraft <[email protected]>
This commit is contained in:
co-authored by
Dylan R. Johnston
Ben Kraft
parent
94b6a71403
commit
c61d7acaa5
@@ -214,6 +214,11 @@ func TestGenerateWithConfig(t *testing.T) {
|
||||
Generated: "generated.go",
|
||||
Optional: "pointer",
|
||||
}},
|
||||
{"OptionalGeneric", "", []string{"ListInput.graphql", "QueryWithSlices.graphql"}, &Config{
|
||||
Generated: "generated.go",
|
||||
Optional: "generic",
|
||||
OptionalGenericType: "github.com/Khan/genqlient/internal/testutil.Option",
|
||||
}},
|
||||
}
|
||||
|
||||
sourceFilename := "SimpleQuery.graphql"
|
||||
|
||||
Reference in New Issue
Block a user