Skip to content

Commit dc58f50

Browse files
committed
chore: update samples to v12.0.0-SNAPSHOT
1 parent 049d87f commit dc58f50

File tree

70 files changed

+2019
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2019
-21
lines changed

Diff for: build.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
id "org.springframework.boot" version "$LIB_SPRING_BOOT_VER" apply false
3-
id 'com.github.sherter.google-java-format' version '0.9' apply false
43
id "org.sonarqube" version "3.2.0"
54
id "jacoco"
65
}
@@ -17,7 +16,6 @@ subprojects {
1716
apply plugin: "java"
1817
apply plugin: 'jacoco'
1918
apply plugin: 'org.sonarqube'
20-
apply plugin: 'com.github.sherter.google-java-format'
2119

2220
group 'com.graphql-kickstart.samples'
2321
version '0.0.1-SNAPSHOT'
@@ -33,8 +31,6 @@ subprojects {
3331
targetCompatibility = 11
3432
}
3533

36-
compileJava.mustRunAfter verifyGoogleJavaFormat
37-
3834
test {
3935
useJUnitPlatform()
4036
}

Diff for: custom-error-handler/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
apply from: "../spring-boot-commons.gradle"
22

33
dependencies {
4-
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
5-
runtimeOnly "com.graphql-java-kickstart:graphiql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
4+
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter"
65
implementation "org.springframework.boot:spring-boot-starter-web"
76

87
compileOnly "org.projectlombok:lombok"
+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
graphql:
22
servlet:
33
exception-handlers-enabled: false
4+
graphiql:
5+
enabled: true

Diff for: directives/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ apply from: "../spring-boot-commons.gradle"
33
dependencies {
44
implementation "org.springframework.boot:spring-boot-starter-web"
55
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
6-
runtimeOnly "com.graphql-java-kickstart:graphiql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
76
implementation 'com.graphql-java:graphql-java-extended-validation:16.0.0'
87

98
compileOnly "org.projectlombok:lombok"

Diff for: editors/LICENSE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Oembedler Inc. and Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8+
persons to whom the Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11+
Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: editors/build.gradle

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2016 oEmbedler Inc. and Contributors
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
8+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
9+
* persons to whom the Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14+
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18+
*/
19+
20+
apply plugin: "org.springframework.boot"
21+
apply plugin: "io.spring.dependency-management"
22+
23+
dependencyManagement {
24+
imports {
25+
mavenBom "org.springframework.boot:spring-boot-starter-parent:$LIB_SPRING_BOOT_VER"
26+
mavenBom "com.graphql-java-kickstart:graphql-spring-boot-dependencies:$LIB_GRAPHQL_SPRING_BOOT_VER"
27+
}
28+
}
29+
30+
dependencies {
31+
implementation("com.graphql-java-kickstart:graphql-spring-boot-starter")
32+
33+
implementation("org.springframework.boot:spring-boot-starter-web")
34+
implementation("org.springframework.boot:spring-boot-starter-websocket")
35+
implementation("org.springframework.boot:spring-boot-starter-actuator")
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2016 oEmbedler Inc. and Contributors
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
8+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
9+
* persons to whom the Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14+
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18+
*/
19+
20+
package graphql.kickstart.sample;
21+
22+
import graphql.Scalars;
23+
import graphql.schema.DataFetcher;
24+
import graphql.schema.FieldCoordinates;
25+
import graphql.schema.GraphQLCodeRegistry;
26+
import graphql.schema.GraphQLObjectType;
27+
import graphql.schema.GraphQLSchema;
28+
import java.util.concurrent.CompletableFuture;
29+
import lombok.extern.slf4j.Slf4j;
30+
import org.springframework.boot.SpringApplication;
31+
import org.springframework.boot.autoconfigure.SpringBootApplication;
32+
import org.springframework.context.annotation.Bean;
33+
34+
@Slf4j
35+
@SpringBootApplication
36+
public class ApplicationBootConfiguration {
37+
38+
public static void main(String[] args) {
39+
SpringApplication.run(ApplicationBootConfiguration.class, args);
40+
}
41+
42+
@Bean
43+
GraphQLSchema schema() {
44+
DataFetcher<CompletableFuture<String>> test =
45+
env -> CompletableFuture.supplyAsync(() -> "response");
46+
return GraphQLSchema.newSchema()
47+
.query(
48+
GraphQLObjectType.newObject()
49+
.name("query")
50+
.field(field -> field.name("test").type(Scalars.GraphQLString))
51+
.build())
52+
.codeRegistry(
53+
GraphQLCodeRegistry.newCodeRegistry()
54+
.dataFetcher(FieldCoordinates.coordinates("query", "test"), test)
55+
.build())
56+
.build();
57+
}
58+
}

Diff for: editors/src/main/resources/application.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
spring:
2+
application:
3+
name: graphql-todo-app
4+
servlet:
5+
multipart:
6+
enabled: true
7+
location: /tmp
8+
main:
9+
allow-bean-definition-overriding: true
10+
server:
11+
port: 9000
12+
management:
13+
endpoints:
14+
web:
15+
exposure:
16+
include: health,info,metrics
17+
graphql:
18+
servlet:
19+
actuator-metrics: true
20+
playground:
21+
enabled: true
22+
cdn:
23+
enabled: false
24+
version: latest
25+
altair:
26+
enabled: true
27+
cdn:
28+
enabled: false
29+
version: 4.0.2
30+
options:
31+
initial-settings:
32+
theme: dracula
33+
endpoint-url: /graphql
34+
35+
graphiql:
36+
enabled: true
37+
cdn:
38+
enabled: false
39+
version: 0.17.5
40+
headers:
41+
Test: TestHeader
42+
props:
43+
variables:
44+
headerEditorEnabled: true
45+
headers: '{ "Authorization": "SomeValue" }'
46+
voyager:
47+
enabled: true
48+
cdn:
49+
enabled: false

Diff for: error-handling-exception-handlers/build.gradle

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
apply from: "../spring-boot-commons.gradle"
2+
apply plugin: "io.spring.dependency-management"
3+
4+
dependencyManagement {
5+
imports {
6+
mavenBom "org.springframework.boot:spring-boot-starter-parent:$LIB_SPRING_BOOT_VER"
7+
mavenBom "com.graphql-java-kickstart:graphql-spring-boot-dependencies:$LIB_GRAPHQL_SPRING_BOOT_VER"
8+
}
9+
}
210

311
dependencies {
4-
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
5-
runtimeOnly "com.graphql-java-kickstart:graphiql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
12+
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter"
613
implementation "org.springframework.boot:spring-boot-starter-web"
714

815
compileOnly "org.projectlombok:lombok"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
graphql:
2+
graphiql:
3+
enabled: true

Diff for: file-upload/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ apply from: "../spring-boot-commons.gradle"
33
dependencies {
44
implementation "org.springframework.boot:spring-boot-starter-web"
55
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
6-
runtimeOnly "com.graphql-java-kickstart:altair-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
76

87
compileOnly "org.projectlombok:lombok"
98
annotationProcessor "org.projectlombok:lombok"

Diff for: gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
LIB_GRAPHQL_SERVLET_VER=11.1.0
2-
LIB_GRAPHQL_SPRING_BOOT_VER=11.0.0
2+
LIB_GRAPHQL_SPRING_BOOT_VER=12.0.0-SNAPSHOT
33
LIB_GRAPHQL_TOOLS_VER=11.0.1
44
LIB_SPRING_BOOT_VER=2.4.5
55
sourceCompatibility=11

Diff for: graphql-annotations/build.gradle

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ apply from: "../spring-boot-commons.gradle"
33
def LIB_GRAPHQL_SPRING_BOOT_VER = "11.0.0"
44

55
dependencies {
6-
implementation "com.graphql-java-kickstart:graphql-kickstart-spring-boot-starter-graphql-annotations:$LIB_GRAPHQL_SPRING_BOOT_VER"
7-
runtimeOnly "com.graphql-java-kickstart:graphiql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
8-
runtimeOnly "com.graphql-java-kickstart:playground-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
9-
runtimeOnly "com.graphql-java-kickstart:voyager-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
6+
runtimeOnly "com.graphql-java-kickstart:graphql-spring-boot-starter:$LIB_GRAPHQL_SPRING_BOOT_VER"
107

118
implementation("org.springframework.boot:spring-boot-starter-web")
129
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
@@ -18,4 +15,4 @@ dependencies {
1815
testImplementation "org.springframework.boot:spring-boot-starter-test"
1916
testAnnotationProcessor "org.projectlombok:lombok"
2017
testImplementation "com.graphql-java-kickstart:graphql-spring-boot-starter-test:$LIB_GRAPHQL_SPRING_BOOT_VER"
21-
}
18+
}

Diff for: request-scoped-dataloader/.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
4+
### IntelliJ IDEA ###
5+
.idea
6+
*.iws
7+
*.iml
8+
*.ipr
9+
.DS_Store

Diff for: request-scoped-dataloader/build.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apply from: "../spring-boot-commons.gradle"
2+
3+
dependencies {
4+
implementation("org.springframework.boot:spring-boot-starter-web")
5+
implementation("com.graphql-java-kickstart:graphql-spring-boot-starter")
6+
7+
testImplementation "org.springframework.boot:spring-boot-starter-test"
8+
testImplementation("com.graphql-java-kickstart:graphql-spring-boot-starter-test")
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package graphql.servlet.examples.dataloader.requestscope;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
6+
7+
@SpringBootApplication
8+
public class Application extends SpringBootServletInitializer {
9+
10+
public static void main(String[] args) {
11+
SpringApplication.run(Application.class, args);
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package graphql.servlet.examples.dataloader.requestscope;
2+
3+
import static java.util.concurrent.CompletableFuture.supplyAsync;
4+
5+
import graphql.kickstart.execution.context.DefaultGraphQLContext;
6+
import graphql.kickstart.execution.context.GraphQLContext;
7+
import graphql.kickstart.servlet.context.DefaultGraphQLServletContext;
8+
import graphql.kickstart.servlet.context.DefaultGraphQLWebSocketContext;
9+
import graphql.kickstart.servlet.context.GraphQLServletContextBuilder;
10+
import javax.servlet.http.HttpServletRequest;
11+
import javax.servlet.http.HttpServletResponse;
12+
import javax.websocket.Session;
13+
import javax.websocket.server.HandshakeRequest;
14+
import org.dataloader.DataLoader;
15+
import org.dataloader.DataLoaderRegistry;
16+
import org.springframework.stereotype.Component;
17+
18+
@Component
19+
public class CustomGraphQLContextBuilder implements GraphQLServletContextBuilder {
20+
21+
private final CustomerRepository customerRepository;
22+
23+
public CustomGraphQLContextBuilder(CustomerRepository customerRepository) {
24+
this.customerRepository = customerRepository;
25+
}
26+
27+
@Override
28+
public GraphQLContext build(HttpServletRequest req, HttpServletResponse response) {
29+
return DefaultGraphQLServletContext.createServletContext(buildDataLoaderRegistry(), null)
30+
.with(req)
31+
.with(response)
32+
.build();
33+
}
34+
35+
@Override
36+
public GraphQLContext build() {
37+
return new DefaultGraphQLContext(buildDataLoaderRegistry(), null);
38+
}
39+
40+
@Override
41+
public GraphQLContext build(Session session, HandshakeRequest request) {
42+
return DefaultGraphQLWebSocketContext.createWebSocketContext(buildDataLoaderRegistry(), null)
43+
.with(session)
44+
.with(request)
45+
.build();
46+
}
47+
48+
private DataLoaderRegistry buildDataLoaderRegistry() {
49+
DataLoaderRegistry dataLoaderRegistry = new DataLoaderRegistry();
50+
DataLoader<Integer, String> customerLoader =
51+
new DataLoader<>(
52+
customerIds -> supplyAsync(() -> customerRepository.getUserNamesForIds(customerIds)));
53+
dataLoaderRegistry.register("customerDataLoader", customerLoader);
54+
return dataLoaderRegistry;
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package graphql.servlet.examples.dataloader.requestscope;
2+
3+
public class Customer {
4+
5+
private int customerId;
6+
7+
public Customer(int customerId) {
8+
this.customerId = customerId;
9+
}
10+
11+
public int getCustomerId() {
12+
return customerId;
13+
}
14+
15+
public void setCustomerId(int customerId) {
16+
this.customerId = customerId;
17+
}
18+
}

0 commit comments

Comments
 (0)