FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
graphql-java/src/test/java/HelloWorld.java at master · graphql-java/graphql-java · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
graphql-java
/
graphql-java
Public
Notifications
You must be signed in to change notification settings
Fork
1.1k
Star
6.2k
Code
Issues
22
Pull requests
17
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
graphql-java
/
src
/
test
/
java
/
HelloWorld.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (25 loc) · 1.22 KB
Breadcrumbs
graphql-java
/
src
/
test
/
java
/
HelloWorld.java
Copy path
File metadata and controls
33 lines (25 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import
graphql
.
ExecutionResult
;
import
graphql
.
GraphQL
;
import
graphql
.
schema
.
GraphQLSchema
;
import
graphql
.
schema
.
StaticDataFetcher
;
import
graphql
.
schema
.
idl
.
RuntimeWiring
;
import
graphql
.
schema
.
idl
.
SchemaGenerator
;
import
graphql
.
schema
.
idl
.
SchemaParser
;
import
graphql
.
schema
.
idl
.
TypeDefinitionRegistry
;
import
static
graphql
.
schema
.
idl
.
RuntimeWiring
.
newRuntimeWiring
;
public
class
HelloWorld
{
public
static
void
main
(
String
[]
args
) {
String
schema
=
"type Query{hello: String}"
;
SchemaParser
schemaParser
=
new
SchemaParser
();
TypeDefinitionRegistry
typeDefinitionRegistry
=
schemaParser
.
parse
(
schema
);
RuntimeWiring
runtimeWiring
=
newRuntimeWiring
()
.
type
(
"Query"
,
builder
->
builder
.
dataFetcher
(
"hello"
,
new
StaticDataFetcher
(
"world"
)))
.
build
();
SchemaGenerator
schemaGenerator
=
new
SchemaGenerator
();
GraphQLSchema
graphQLSchema
=
schemaGenerator
.
makeExecutableSchema
(
typeDefinitionRegistry
,
runtimeWiring
);
GraphQL
build
=
GraphQL
.
newGraphQL
(
graphQLSchema
).
build
();
ExecutionResult
executionResult
=
build
.
execute
(
"{hello}"
);
System
.
out
.
println
(
executionResult
.
getData
().
toString
());
// Prints: {hello=world}
}
}
Back
|
FazBrowse Home
|
New Git URL