You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code generation using gradle plugin from graphql schema fails with this message: Unexpected array default value for non-list type
Here is a snippet of the schema, I actually identified the part that fails:
type Query {
"Select error events"
select_error(
"Maximum number of objects to return"
first: Int! = 1000,
"List of possible options for the group by"
group_by: [bus_error_groupby_enum!]! = []
): [error_activity]
the part that causes the issue is this: group_by: [bus_error_groupby_enum!]! = []
changing it to this, gets rid of the issue: group_by: [bus_error_groupby_enum!] = []
I tried the code to understand where it came from and apparently it is in
src/main/java/com/kobylynskyi/graphql/codegen/mapper/DefaultValueMapper.java
private static String mapArray(MappingContext mappingContext, ArrayValue defaultValue, Type<?> graphQLType) {
if (!(graphQLType instanceof ListType)) {
throw new IllegalArgumentException("Unexpected array default value for non-list type");
}
the defaultValue is a list while the type is actually not a ListType but a NonNullType
Steps to Reproduce
Add this to your schema and try to generate the code group_by: [bus_error_groupby_enum!]! = []
Expected Result
I would expect a NonNullType of List to accept a default value of type List
Actual Result
Code generation using gradle plugin from graphql schema fails with this message: Unexpected array default value for non-list type
@kobylynskyi thanks for this very cool plugin of yours, I like how readable and easy it is to build queries with the generated code :)
I'll switch to using generateClient thanks for letting me know.
On a side note, may I ask if you plan on supporting sbt plugin again? I know that there was one but not published and with a bit less "capabilities".
Issue Description
Code generation using gradle plugin from graphql schema fails with this message:
Unexpected array default value for non-list type
Here is a snippet of the schema, I actually identified the part that fails:
the part that causes the issue is this:
group_by: [bus_error_groupby_enum!]! = []
changing it to this, gets rid of the issue:
group_by: [bus_error_groupby_enum!] = []
I tried the code to understand where it came from and apparently it is in
src/main/java/com/kobylynskyi/graphql/codegen/mapper/DefaultValueMapper.java
the defaultValue is a list while the type is actually not a ListType but a NonNullType
Steps to Reproduce
Add this to your schema and try to generate the code
group_by: [bus_error_groupby_enum!]! = []
Expected Result
I would expect a NonNullType of List to accept a default value of type List
Actual Result
Code generation using gradle plugin from graphql schema fails with this message:
Unexpected array default value for non-list type
Your Environment and Setup
The text was updated successfully, but these errors were encountered: