Skip to content

Commit fe0ff28

Browse files
committed
Add new config parameter: generateAsyncApi. Bump version to 1.4.1
1 parent b13d724 commit fe0ff28

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This Gradle plugin is able to generate the following classes based on your Graph
1818

1919
```groovy
2020
plugins {
21-
id "io.github.kobylynskyi.graphql.codegen" version "1.4.0"
21+
id "io.github.kobylynskyi.graphql.codegen" version "1.4.1"
2222
}
2323
```
2424

@@ -32,7 +32,7 @@ buildscript {
3232
}
3333
}
3434
dependencies {
35-
classpath "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:1.4.0"
35+
classpath "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:1.4.1"
3636
}
3737
}
3838
@@ -51,7 +51,7 @@ graphqlCodegen {
5151
outputDir = "$buildDir/generated/graphql"
5252
packageName = "com.example.graphql.model"
5353
customTypesMapping = [
54-
DateTime: "org.joda.time.DateTime"
54+
DateTime: "org.joda.time.DateTime",
5555
Price.amount: "java.math.BigDecimal"
5656
]
5757
customAnnotationsMapping = [
@@ -107,6 +107,7 @@ check.dependsOn(graphqlCodegen)
107107
| subscriptionReturnType | String | Empty | Return type for subscription methods. For example: `org.reactivestreams.Publisher`, `io.reactivex.Observable`, etc. |
108108
| generateEqualsAndHashCode | Boolean | False | Specifies whether generated model classes should have equals and hashCode methods defined. |
109109
| generateToString | Boolean | False | Specifies whether generated model classes should have toString method defined. |
110+
| generateAsyncApi | Boolean | False | If true, then wrap type into `java.util.concurrent.CompletableFuture` or `subscriptionReturnType` |
110111
| jsonConfigurationFile | String | Empty | Path to an external mapping configuration. |
111112

112113
#### External mapping configuration

graphql-codegen-gradle-plugin-example/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id "idea"
44
id "application"
55
id "net.ltgt.apt" version "0.20"
6-
id "io.github.kobylynskyi.graphql.codegen" version "1.4.0"
6+
id "io.github.kobylynskyi.graphql.codegen" version "1.4.1"
77
}
88

99
mainClassName = "io.github.kobylynskyi.bikeshop.Application"

graphql-codegen-gradle-plugin/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id "com.gradle.plugin-publish" version "0.10.1"
2+
id "com.gradle.plugin-publish" version "0.11.0"
33
id "java-gradle-plugin"
44
}
55

@@ -17,13 +17,13 @@ apply plugin: "idea"
1717
apply plugin: "maven-publish"
1818

1919
group = "io.github.kobylynskyi"
20-
version = "1.4.0"
20+
version = "1.4.1"
2121
description = "Provides a task for generating Java code based on GraphQL schema"
2222

2323
dependencies {
2424
compile gradleApi()
2525

26-
compile 'io.github.kobylynskyi:graphql-java-codegen:1.4.0'
26+
compile 'io.github.kobylynskyi:graphql-java-codegen:1.4.1'
2727

2828
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.1'
2929
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.1'

graphql-codegen-gradle-plugin/src/main/java/io/github/kobylynskyi/graphql/codegen/gradle/GraphqlCodegenGradleTask.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class GraphqlCodegenGradleTask extends DefaultTask {
3636
private String modelValidationAnnotation;
3737
private Boolean generateEqualsAndHashCode = false;
3838
private Boolean generateToString = false;
39+
private Boolean generateAsyncApi = false;
3940
private String jsonConfigurationFile;
4041

4142
@TaskAction
@@ -53,6 +54,7 @@ public void generate() throws Exception {
5354
mappingConfig.setCustomAnnotationsMapping(customAnnotationsMapping);
5455
mappingConfig.setGenerateEqualsAndHashCode(generateEqualsAndHashCode);
5556
mappingConfig.setGenerateToString(generateToString);
57+
mappingConfig.setGenerateAsyncApi(generateAsyncApi);
5658

5759
new GraphqlCodegen(graphqlSchemaPaths, outputDir, mappingConfig, buildJsonSupplier()).generate();
5860
}
@@ -202,6 +204,16 @@ public void setSubscriptionReturnType(String subscriptionReturnType) {
202204
this.subscriptionReturnType = subscriptionReturnType;
203205
}
204206

207+
@Input
208+
@Optional
209+
public Boolean getGenerateAsyncApi() {
210+
return generateAsyncApi;
211+
}
212+
213+
public void setGenerateAsyncApi(Boolean generateAsyncApi) {
214+
this.generateAsyncApi = generateAsyncApi;
215+
}
216+
205217
@Input
206218
@Optional
207219
public String getJsonConfigurationFile() {

0 commit comments

Comments
 (0)