diff --git a/client/implementation/src/main/java/io/smallrye/graphql/client/impl/typesafe/reflection/ParameterInfo.java b/client/implementation/src/main/java/io/smallrye/graphql/client/impl/typesafe/reflection/ParameterInfo.java index d7d37f7a1..52d2be2ec 100644 --- a/client/implementation/src/main/java/io/smallrye/graphql/client/impl/typesafe/reflection/ParameterInfo.java +++ b/client/implementation/src/main/java/io/smallrye/graphql/client/impl/typesafe/reflection/ParameterInfo.java @@ -36,7 +36,11 @@ public String toString() { public String graphQlInputTypeName() { if (parameter.isAnnotationPresent(Id.class)) { - return "ID" + optionalExclamationMark(type); + if (type.isCollection()) { + return "[ID" + optionalExclamationMark(type.getItemType()) + "]" + optionalExclamationMark(type); + } else { + return "ID" + optionalExclamationMark(type); + } } else if (type.isCollection()) { return "[" + withExclamationMark(type.getItemType()) + "]" + optionalExclamationMark(type); } else if (type.isMap()) { diff --git a/client/tck/src/main/java/tck/graphql/typesafe/ScalarBehavior.java b/client/tck/src/main/java/tck/graphql/typesafe/ScalarBehavior.java index 21324089b..0d734ccf6 100644 --- a/client/tck/src/main/java/tck/graphql/typesafe/ScalarBehavior.java +++ b/client/tck/src/main/java/tck/graphql/typesafe/ScalarBehavior.java @@ -1,6 +1,7 @@ package tck.graphql.typesafe; import static java.time.ZoneOffset.UTC; +import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.catchThrowableOfType; import static org.assertj.core.api.BDDAssertions.then; @@ -15,6 +16,7 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.Date; +import java.util.List; import java.util.UUID; import org.eclipse.microprofile.graphql.Id; @@ -584,9 +586,14 @@ interface IdApi { @Id String idea( @Id String stringId, + @Id List stringListId, + @Id List<@NonNull String> stringListInnerNonNullId, + @Id @NonNull List stringListOuterNonNullId, + @Id @NonNull List<@NonNull String> stringListBothNonNullId, @Id long primitiveLongId, @Id int primitiveIntId, @Id Long longId, + @Id List longListId, @Id Integer intId, @Id UUID uuidId); } @@ -719,20 +726,31 @@ void shouldCallIdQuery() { fixture.returnsData("'idea':'out'"); IdApi api = fixture.builder().build(IdApi.class); - String out = api.idea("stringId", 1L, 2, 3L, 4, UUID.randomUUID()); + String out = api.idea("stringId", singletonList("x"), singletonList("x"), singletonList("x"), singletonList("x"), + 1L, 2, 3L, singletonList(5L), 4, UUID.randomUUID()); then(fixture.query()).isEqualTo("query idea(" + "$stringId: ID, " + + "$stringListId: [ID], " + + "$stringListInnerNonNullId: [ID!], " + + "$stringListOuterNonNullId: [ID]!, " + + "$stringListBothNonNullId: [ID!]!, " + "$primitiveLongId: ID!, " + "$primitiveIntId: ID!, " + "$longId: ID, " + + "$longListId: [ID], " + "$intId: ID, " + "$uuidId: ID) " + "{ idea(" + "stringId: $stringId, " + + "stringListId: $stringListId, " + + "stringListInnerNonNullId: $stringListInnerNonNullId, " + + "stringListOuterNonNullId: $stringListOuterNonNullId, " + + "stringListBothNonNullId: $stringListBothNonNullId, " + "primitiveLongId: $primitiveLongId, " + "primitiveIntId: $primitiveIntId, " + "longId: $longId, " + + "longListId: $longListId, " + "intId: $intId, " + "uuidId: $uuidId) }"); then(out).isEqualTo("out");