From fbadc3727b07b5ef94dc404133044cd486e08bf6 Mon Sep 17 00:00:00 2001 From: Bogdan Kobylynskyi <92bogdan@gmail.com> Date: Tue, 27 Apr 2021 10:04:33 +0300 Subject: [PATCH 1/6] Update to next development version: 5.1.0-SNAPSHOT --- build.gradle | 2 +- plugins/gradle/README.md | 4 ++-- plugins/gradle/example-client-kotlin/build.gradle | 6 +++--- plugins/gradle/example-client/build.gradle | 4 ++-- plugins/gradle/example-server/build.gradle | 2 +- .../gradle/graphql-java-codegen-gradle-plugin/build.gradle | 2 +- plugins/maven/README.md | 2 +- plugins/maven/example-client/pom.xml | 2 +- plugins/maven/example-server/pom.xml | 2 +- plugins/maven/graphql-java-codegen-maven-plugin/pom.xml | 4 ++-- .../example-client-scala/project/plugins.sbt | 2 +- .../example-client-scala/version.sbt | 2 +- .../example-client/project/plugins.sbt | 2 +- .../graphql-codegen-sbt-plugin/example-client/version.sbt | 2 +- .../graphql-codegen-sbt-plugin/simple/project/plugins.sbt | 2 +- .../sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt | 2 +- plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt | 2 +- 17 files changed, 22 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 65beab042..2a7dab150 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { id "org.sonarqube" version "3.1.1" } -def graphqlCodegenVersion = '5.1.0' // This variable used in the automatic release process +def graphqlCodegenVersion = '5.1.1-SNAPSHOT' // This variable used in the automatic release process group = "io.github.kobylynskyi" version = graphqlCodegenVersion diff --git a/plugins/gradle/README.md b/plugins/gradle/README.md index c21bbb604..b266bc340 100644 --- a/plugins/gradle/README.md +++ b/plugins/gradle/README.md @@ -17,7 +17,7 @@ ```groovy plugins { - id "io.github.kobylynskyi.graphql.codegen" version "5.1.0" + id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" } ``` @@ -31,7 +31,7 @@ buildscript { } } dependencies { - classpath "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:5.1.0" + classpath "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:5.1.1-SNAPSHOT" } } diff --git a/plugins/gradle/example-client-kotlin/build.gradle b/plugins/gradle/example-client-kotlin/build.gradle index 1fe7403d7..a406c794f 100644 --- a/plugins/gradle/example-client-kotlin/build.gradle +++ b/plugins/gradle/example-client-kotlin/build.gradle @@ -4,10 +4,10 @@ import io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask plugins { id 'java' id "org.jetbrains.kotlin.jvm" version "1.3.71" - id "io.github.kobylynskyi.graphql.codegen" version "5.1.0" + id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" } -def graphqlCodegenClientKotlinVersion = '5.1.0' // Variable used in the automatic release process +def graphqlCodegenClientKotlinVersion = '5.1.1-SNAPSHOT' // Variable used in the automatic release process group = 'io.github.dreamylost' version = graphqlCodegenClientKotlinVersion @@ -29,7 +29,7 @@ repositories { dependencies { - implementation "io.github.kobylynskyi:graphql-java-codegen:5.1.0" + implementation "io.github.kobylynskyi:graphql-java-codegen:5.1.1-SNAPSHOT" implementation "javax.validation:validation-api:2.0.1.Final" implementation "com.squareup.okhttp3:okhttp:4.2.2" implementation "com.fasterxml.jackson.core:jackson-core:2.12.0" diff --git a/plugins/gradle/example-client/build.gradle b/plugins/gradle/example-client/build.gradle index 339651c7f..dd1f72137 100644 --- a/plugins/gradle/example-client/build.gradle +++ b/plugins/gradle/example-client/build.gradle @@ -7,7 +7,7 @@ plugins { // use the latest available version: // https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen - id "io.github.kobylynskyi.graphql.codegen" version "5.1.0" + id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" } mainClassName = "io.github.kobylynskyi.order.Application" @@ -22,7 +22,7 @@ dependencies { // use the latest available version: // https://search.maven.org/artifact/io.github.kobylynskyi/graphql-java-codegen - implementation "io.github.kobylynskyi:graphql-java-codegen:5.1.0" + implementation "io.github.kobylynskyi:graphql-java-codegen:5.1.1-SNAPSHOT" implementation "org.apache.httpcomponents:httpclient:4.5.13" implementation "javax.validation:validation-api:2.0.1.Final" diff --git a/plugins/gradle/example-server/build.gradle b/plugins/gradle/example-server/build.gradle index 1d0ff366b..e3692a0f4 100644 --- a/plugins/gradle/example-server/build.gradle +++ b/plugins/gradle/example-server/build.gradle @@ -6,7 +6,7 @@ plugins { // // use the latest available version: // https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen - id "io.github.kobylynskyi.graphql.codegen" version "5.1.0" + id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" } mainClassName = "io.github.kobylynskyi.product.Application" diff --git a/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle b/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle index 296807845..3e21de122 100644 --- a/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle +++ b/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle @@ -16,7 +16,7 @@ apply plugin: "java" apply plugin: "idea" apply plugin: "maven-publish" -def graphqlCodegenGradlePluginVersion = '5.1.0' // This variable used in the automatic release process +def graphqlCodegenGradlePluginVersion = '5.1.1-SNAPSHOT' // This variable used in the automatic release process group = "io.github.kobylynskyi" version = graphqlCodegenGradlePluginVersion diff --git a/plugins/maven/README.md b/plugins/maven/README.md index f7aa977c2..4b41be462 100644 --- a/plugins/maven/README.md +++ b/plugins/maven/README.md @@ -20,7 +20,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin - 5.1.0 + 5.1.1-SNAPSHOT diff --git a/plugins/maven/example-client/pom.xml b/plugins/maven/example-client/pom.xml index 6114f1f68..3223ffbd6 100644 --- a/plugins/maven/example-client/pom.xml +++ b/plugins/maven/example-client/pom.xml @@ -4,7 +4,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin-example-client - 5.1.0 + 5.1.1-SNAPSHOT graphql-codegen-maven-plugin-example-client diff --git a/plugins/maven/example-server/pom.xml b/plugins/maven/example-server/pom.xml index 025ce40ca..4f6a85249 100644 --- a/plugins/maven/example-server/pom.xml +++ b/plugins/maven/example-server/pom.xml @@ -4,7 +4,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin-example-server - 5.1.0 + 5.1.1-SNAPSHOT graphql-codegen-maven-plugin-example-server diff --git a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml index c3633e210..0766b81d3 100644 --- a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml +++ b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml @@ -3,7 +3,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin - 5.1.0 + 5.1.1-SNAPSHOT maven-plugin graphql-codegen-maven-plugin @@ -72,7 +72,7 @@ 1.6 3.3.3 - 5.1.0 + 5.1.1-SNAPSHOT diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt index cf4e76ea7..b99c3c7a4 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.1.0") +addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.1.1-SNAPSHOT") diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt index 0182ca739..7228b47aa 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.0" +version in ThisBuild := "5.1.1-SNAPSHOT" diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt index cf4e76ea7..b99c3c7a4 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.1.0") +addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.1.1-SNAPSHOT") diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt index 0182ca739..7228b47aa 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.0" +version in ThisBuild := "5.1.1-SNAPSHOT" diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt index 7cbd42d43..6026891b4 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt @@ -1,4 +1,4 @@ -sys.props.get("plugin.version").orElse(Some("5.1.0")) match { +sys.props.get("plugin.version").orElse(Some("5.1.1-SNAPSHOT")) match { case Some(x) => addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt index 0182ca739..7228b47aa 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.0" +version in ThisBuild := "5.1.1-SNAPSHOT" diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt index 0182ca739..7228b47aa 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.0" +version in ThisBuild := "5.1.1-SNAPSHOT" From 25e646437a6627fbbb1c8b15c33aa38a61afea30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 12:19:06 +0300 Subject: [PATCH 2/6] Bump maven-gpg-plugin from 1.6 to 3.0.1 (#684) Bumps [maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 1.6 to 3.0.1. - [Release notes](https://github.com/apache/maven-gpg-plugin/releases) - [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-1.6...maven-gpg-plugin-3.0.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bogdan Kobylynskyi <92bogdan@gmail.com> --- plugins/maven/graphql-java-codegen-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml index 0766b81d3..73c10fc8d 100644 --- a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml +++ b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml @@ -69,7 +69,7 @@ 2.5.3 3.2.0 1.11.2 - 1.6 + 3.0.1 3.3.3 5.1.1-SNAPSHOT From b6c50aa0b5d6b875d9b4c43fba36c52c4609ca04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 12:25:48 +0300 Subject: [PATCH 3/6] Bump maven-shared-utils from 3.3.3 to 3.3.4 (#678) Bumps [maven-shared-utils](https://github.com/apache/maven-shared-utils) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/apache/maven-shared-utils/releases) - [Commits](https://github.com/apache/maven-shared-utils/compare/maven-shared-utils-3.3.3...maven-shared-utils-3.3.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bogdan Kobylynskyi <92bogdan@gmail.com> --- plugins/maven/graphql-java-codegen-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml index 73c10fc8d..816b445ca 100644 --- a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml +++ b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml @@ -70,7 +70,7 @@ 3.2.0 1.11.2 3.0.1 - 3.3.3 + 3.3.4 5.1.1-SNAPSHOT From d2665348b2479c6f570a4130d6c9b9c5f81dbae7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 12:26:39 +0300 Subject: [PATCH 4/6] Bump org.sonarqube from 3.1.1 to 3.2.0 (#675) Bumps org.sonarqube from 3.1.1 to 3.2.0. Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bogdan Kobylynskyi <92bogdan@gmail.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2a7dab150..f8970ed7f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { id "java-library" id "signing" id "maven-publish" - id "org.sonarqube" version "3.1.1" + id "org.sonarqube" version "3.2.0" } def graphqlCodegenVersion = '5.1.1-SNAPSHOT' // This variable used in the automatic release process From b6d34be2e0e63bfbbd78a84f62873efbbbb32dc4 Mon Sep 17 00:00:00 2001 From: Robbert Noordzij Date: Tue, 11 May 2021 13:28:56 +0200 Subject: [PATCH 5/6] Ability to add custom operation name for request (#682) * Ability to add custom operation name for request Co-authored-by: Robbert Noordzij Co-authored-by: Bogdan Kobylynskyi <92bogdan@gmail.com> --- .../codegen/model/graphql/GraphQLRequest.java | 17 +++++- .../graphql/GraphQLRequestSerializer.java | 8 ++- .../model/graphql/GraphQLRequests.java | 10 ++++ .../graphql/GraphQLRequestSerializerTest.java | 53 +++++++++++++++++++ 4 files changed, 85 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequest.java b/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequest.java index e092afdeb..0f10b065a 100644 --- a/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequest.java +++ b/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequest.java @@ -5,14 +5,25 @@ */ public class GraphQLRequest { + private final String operationName; private final GraphQLOperationRequest request; private final GraphQLResponseProjection responseProjection; public GraphQLRequest(GraphQLOperationRequest request) { - this(request, null); + this(null, request, null); + } + + public GraphQLRequest(String operationName, GraphQLOperationRequest request) { + this(operationName, request, null); } public GraphQLRequest(GraphQLOperationRequest request, GraphQLResponseProjection responseProjection) { + this(null, request, responseProjection); + } + + public GraphQLRequest(String operationName, GraphQLOperationRequest request, + GraphQLResponseProjection responseProjection) { + this.operationName = operationName; this.request = request; this.responseProjection = responseProjection; } @@ -25,6 +36,10 @@ public GraphQLResponseProjection getResponseProjection() { return responseProjection; } + public String getOperationName() { + return operationName; + } + /** * Serializes GraphQL request to be used as HTTP JSON body * according to https://graphql.org/learn/serving-over-http specifications diff --git a/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializer.java b/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializer.java index 885dabc80..f16800a4b 100644 --- a/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializer.java +++ b/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializer.java @@ -49,7 +49,7 @@ public static String toHttpJsonBody(GraphQLRequests graphQLRequests) { } return jsonQuery(operationWrapper( firstRequest.getOperationType(), - null, // combined request does not have operation name + graphQLRequests.getOperationName(), queryBuilder.toString())); } @@ -77,9 +77,13 @@ public static String toQueryString(GraphQLRequest graphQLRequest) { if (graphQLRequest == null || graphQLRequest.getRequest() == null) { return null; } + + String operationName = graphQLRequest.getOperationName() == null ? + graphQLRequest.getRequest().getOperationName() : graphQLRequest.getOperationName(); + return operationWrapper( graphQLRequest.getRequest().getOperationType(), - graphQLRequest.getRequest().getOperationName(), + operationName, buildQuery(graphQLRequest)); } diff --git a/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequests.java b/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequests.java index 98f3756fd..26afa8696 100644 --- a/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequests.java +++ b/src/main/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequests.java @@ -9,9 +9,15 @@ */ public class GraphQLRequests { + private final String operationName; private final List requests = new ArrayList<>(); public GraphQLRequests(GraphQLRequest... requests) { + this(null, requests); + } + + public GraphQLRequests(String operationName, GraphQLRequest... requests) { + this.operationName = operationName; this.requests.addAll(Arrays.asList(requests)); } @@ -23,6 +29,10 @@ public List getRequests() { return new ArrayList<>(requests); } + public String getOperationName() { + return operationName; + } + /** * Serializes multiple GraphQL requests to be used as HTTP JSON body * according to https://graphql.org/learn/serving-over-http specifications diff --git a/src/test/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializerTest.java b/src/test/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializerTest.java index aa90a4378..25bc0bad2 100644 --- a/src/test/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializerTest.java +++ b/src/test/java/com/kobylynskyi/graphql/codegen/model/graphql/GraphQLRequestSerializerTest.java @@ -256,6 +256,27 @@ void serialize_withResponseProjectionAndParametrizedInputAndAlias(String name, assertEquals(expectedQueryDecorator.apply(expectedQueryStr), serializedQuery); } + @ParameterizedTest(name = "{0}") + @MethodSource("provideAllSerializers") + void serialize_withCustomOpertionName(String name, Function serializer, + Function expectedQueryDecorator) { + EventsByIdsQueryRequest request = new EventsByIdsQueryRequest.Builder() + .setContextId("something") + .setIds(null) + .setTranslated(false) + .build(); + GraphQLRequest graphQLRequest = new GraphQLRequest( + "customOperationName", + request, + new EventResponseProjection() + .id() + ); + String serializedQuery = serializer.apply(graphQLRequest).replaceAll(" +", " ").trim(); + String expectedQueryStr = "query customOperationName { " + + "eventsByIds(contextId: \"something\", translated: false){ id } }"; + assertEquals(expectedQueryDecorator.apply(expectedQueryStr), serializedQuery); + } + @ParameterizedTest(name = "{0}") @MethodSource("provideAllSerializers") void serialize_complexRequestWithDefaultData(String name, Function serializer, @@ -505,6 +526,38 @@ void serialize_multipleRequests(String name, Function s assertEquals(expectedQueryDecorator.apply(expectedQueryStr), serializedQuery); } + @ParameterizedTest(name = "{0}") + @MethodSource("provideStaticSerializerForMultiRequest") + void serialize_multipleRequestsWithCustomOperationName(String name, Function serializer, + Function expectedQueryDecorator) { + EventsByCategoryAndStatusQueryRequest request1 = new EventsByCategoryAndStatusQueryRequest.Builder() + .alias("req1").setStatus(Status.OPEN).build(); + GraphQLRequest graphQLRequest1 = new GraphQLRequest(request1, new EventResponseProjection().id()); + + EventsByCategoryAndStatusQueryRequest request2 = new EventsByCategoryAndStatusQueryRequest("req2"); + GraphQLRequest graphQLRequest2 = new GraphQLRequest(request2, new EventResponseProjection().id().status()); + + EventsByCategoryAndStatusQueryRequest request21 = new EventsByCategoryAndStatusQueryRequest(); + GraphQLRequest graphQLRequest21 = new GraphQLRequest(request21); + + GraphQLRequests requests = new GraphQLRequests( + "customOperationName", + graphQLRequest1, + graphQLRequest2, + graphQLRequest21 + ); + + String serializedQuery = serializer + .apply(requests).replaceAll(" +", " ") + .trim(); + String expectedQueryStr = "query customOperationName { " + + "req1: eventsByCategoryAndStatus(status: OPEN){ id } " + + "req2: eventsByCategoryAndStatus{ id status } " + + "eventsByCategoryAndStatus " + + "}"; + assertEquals(expectedQueryDecorator.apply(expectedQueryStr), serializedQuery); + } + @ParameterizedTest(name = "{0}") @MethodSource("provideStaticSerializerForMultiRequest") void serialize_multipleRequests_DiffTypes(String name, Function serializer, From 26700c962892c789b6c79b3057a541d4ba3cd1bd Mon Sep 17 00:00:00 2001 From: Bogdan Kobylynskyi <92bogdan@gmail.com> Date: Wed, 16 Jun 2021 15:54:50 +0300 Subject: [PATCH 6/6] Bump version to 5.2.0 - release --- build.gradle | 2 +- plugins/gradle/README.md | 4 ++-- plugins/gradle/example-client-kotlin/build.gradle | 6 +++--- plugins/gradle/example-client/build.gradle | 4 ++-- plugins/gradle/example-server/build.gradle | 2 +- .../gradle/graphql-java-codegen-gradle-plugin/build.gradle | 2 +- plugins/maven/README.md | 2 +- plugins/maven/example-client/pom.xml | 2 +- plugins/maven/example-server/pom.xml | 2 +- plugins/maven/graphql-java-codegen-maven-plugin/pom.xml | 4 ++-- .../example-client-scala/project/plugins.sbt | 2 +- .../example-client-scala/version.sbt | 2 +- .../example-client/project/plugins.sbt | 2 +- .../graphql-codegen-sbt-plugin/example-client/version.sbt | 2 +- .../graphql-codegen-sbt-plugin/simple/project/plugins.sbt | 2 +- .../sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt | 2 +- plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt | 2 +- 17 files changed, 22 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index f8970ed7f..1f38d5d81 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { id "org.sonarqube" version "3.2.0" } -def graphqlCodegenVersion = '5.1.1-SNAPSHOT' // This variable used in the automatic release process +def graphqlCodegenVersion = '5.2.0' // This variable used in the automatic release process group = "io.github.kobylynskyi" version = graphqlCodegenVersion diff --git a/plugins/gradle/README.md b/plugins/gradle/README.md index b266bc340..9de452060 100644 --- a/plugins/gradle/README.md +++ b/plugins/gradle/README.md @@ -17,7 +17,7 @@ ```groovy plugins { - id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" + id "io.github.kobylynskyi.graphql.codegen" version "5.2.0" } ``` @@ -31,7 +31,7 @@ buildscript { } } dependencies { - classpath "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:5.1.1-SNAPSHOT" + classpath "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:5.2.0" } } diff --git a/plugins/gradle/example-client-kotlin/build.gradle b/plugins/gradle/example-client-kotlin/build.gradle index a406c794f..01b3bd777 100644 --- a/plugins/gradle/example-client-kotlin/build.gradle +++ b/plugins/gradle/example-client-kotlin/build.gradle @@ -4,10 +4,10 @@ import io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask plugins { id 'java' id "org.jetbrains.kotlin.jvm" version "1.3.71" - id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" + id "io.github.kobylynskyi.graphql.codegen" version "5.2.0" } -def graphqlCodegenClientKotlinVersion = '5.1.1-SNAPSHOT' // Variable used in the automatic release process +def graphqlCodegenClientKotlinVersion = '5.2.0' // Variable used in the automatic release process group = 'io.github.dreamylost' version = graphqlCodegenClientKotlinVersion @@ -29,7 +29,7 @@ repositories { dependencies { - implementation "io.github.kobylynskyi:graphql-java-codegen:5.1.1-SNAPSHOT" + implementation "io.github.kobylynskyi:graphql-java-codegen:5.2.0" implementation "javax.validation:validation-api:2.0.1.Final" implementation "com.squareup.okhttp3:okhttp:4.2.2" implementation "com.fasterxml.jackson.core:jackson-core:2.12.0" diff --git a/plugins/gradle/example-client/build.gradle b/plugins/gradle/example-client/build.gradle index dd1f72137..3ac95f100 100644 --- a/plugins/gradle/example-client/build.gradle +++ b/plugins/gradle/example-client/build.gradle @@ -7,7 +7,7 @@ plugins { // use the latest available version: // https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen - id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" + id "io.github.kobylynskyi.graphql.codegen" version "5.2.0" } mainClassName = "io.github.kobylynskyi.order.Application" @@ -22,7 +22,7 @@ dependencies { // use the latest available version: // https://search.maven.org/artifact/io.github.kobylynskyi/graphql-java-codegen - implementation "io.github.kobylynskyi:graphql-java-codegen:5.1.1-SNAPSHOT" + implementation "io.github.kobylynskyi:graphql-java-codegen:5.2.0" implementation "org.apache.httpcomponents:httpclient:4.5.13" implementation "javax.validation:validation-api:2.0.1.Final" diff --git a/plugins/gradle/example-server/build.gradle b/plugins/gradle/example-server/build.gradle index e3692a0f4..f78bbddd3 100644 --- a/plugins/gradle/example-server/build.gradle +++ b/plugins/gradle/example-server/build.gradle @@ -6,7 +6,7 @@ plugins { // // use the latest available version: // https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen - id "io.github.kobylynskyi.graphql.codegen" version "5.1.1-SNAPSHOT" + id "io.github.kobylynskyi.graphql.codegen" version "5.2.0" } mainClassName = "io.github.kobylynskyi.product.Application" diff --git a/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle b/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle index 3e21de122..3e553b03e 100644 --- a/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle +++ b/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle @@ -16,7 +16,7 @@ apply plugin: "java" apply plugin: "idea" apply plugin: "maven-publish" -def graphqlCodegenGradlePluginVersion = '5.1.1-SNAPSHOT' // This variable used in the automatic release process +def graphqlCodegenGradlePluginVersion = '5.2.0' // This variable used in the automatic release process group = "io.github.kobylynskyi" version = graphqlCodegenGradlePluginVersion diff --git a/plugins/maven/README.md b/plugins/maven/README.md index 4b41be462..5f8b825f8 100644 --- a/plugins/maven/README.md +++ b/plugins/maven/README.md @@ -20,7 +20,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin - 5.1.1-SNAPSHOT + 5.2.0 diff --git a/plugins/maven/example-client/pom.xml b/plugins/maven/example-client/pom.xml index 3223ffbd6..1d963d8bf 100644 --- a/plugins/maven/example-client/pom.xml +++ b/plugins/maven/example-client/pom.xml @@ -4,7 +4,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin-example-client - 5.1.1-SNAPSHOT + 5.2.0 graphql-codegen-maven-plugin-example-client diff --git a/plugins/maven/example-server/pom.xml b/plugins/maven/example-server/pom.xml index 4f6a85249..dd8be84af 100644 --- a/plugins/maven/example-server/pom.xml +++ b/plugins/maven/example-server/pom.xml @@ -4,7 +4,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin-example-server - 5.1.1-SNAPSHOT + 5.2.0 graphql-codegen-maven-plugin-example-server diff --git a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml index 816b445ca..dfbea7c55 100644 --- a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml +++ b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml @@ -3,7 +3,7 @@ io.github.kobylynskyi graphql-codegen-maven-plugin - 5.1.1-SNAPSHOT + 5.2.0 maven-plugin graphql-codegen-maven-plugin @@ -72,7 +72,7 @@ 3.0.1 3.3.4 - 5.1.1-SNAPSHOT + 5.2.0 diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt index b99c3c7a4..4e93c6101 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.1.1-SNAPSHOT") +addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.2.0") diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt index 7228b47aa..371c2bd0f 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.1-SNAPSHOT" +version in ThisBuild := "5.2.0" diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt index b99c3c7a4..4e93c6101 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.1.1-SNAPSHOT") +addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % "5.2.0") diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt index 7228b47aa..371c2bd0f 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.1-SNAPSHOT" +version in ThisBuild := "5.2.0" diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt index 6026891b4..86976e256 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt @@ -1,4 +1,4 @@ -sys.props.get("plugin.version").orElse(Some("5.1.1-SNAPSHOT")) match { +sys.props.get("plugin.version").orElse(Some("5.2.0")) match { case Some(x) => addSbtPlugin("io.github.jxnu-liguobin" % "graphql-codegen-sbt-plugin" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt index 7228b47aa..371c2bd0f 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.1-SNAPSHOT" +version in ThisBuild := "5.2.0" diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt index 7228b47aa..371c2bd0f 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt @@ -1 +1 @@ -version in ThisBuild := "5.1.1-SNAPSHOT" +version in ThisBuild := "5.2.0"