Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph QL #2504

Merged
merged 180 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 162 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
850c00a
Initial helidon-microprofile-graphql project setup
tmiddlet2666 Mar 3, 2020
238f7fe
checkstyle fixes
tmiddlet2666 Mar 3, 2020
59f0a6e
progress commit
tmiddlet2666 Mar 5, 2020
eca7e48
post adding GraphQLIT
tmiddlet2666 Mar 6, 2020
91173bc
initial GraphQLApi work
tmiddlet2666 Mar 6, 2020
79fa727
progress update
tmiddlet2666 Mar 6, 2020
167fc83
progress
tmiddlet2666 Mar 9, 2020
43e2512
progress
tmiddlet2666 Mar 10, 2020
a0cccf7
add tck and runner modules
tmiddlet2666 Mar 11, 2020
85718d0
fixup issues with ID fields
tmiddlet2666 Mar 11, 2020
048c763
flatten the package structure
tmiddlet2666 Mar 11, 2020
56f7e24
working on arrays
tmiddlet2666 Mar 11, 2020
06bc254
fixup arrays and lists
tmiddlet2666 Mar 12, 2020
9589fa2
fixup missing scalars
tmiddlet2666 Mar 12, 2020
9cfb819
refactoring
tmiddlet2666 Mar 12, 2020
4eaeeaf
copyright and checkstyle
tmiddlet2666 Mar 12, 2020
9a4f0c6
add additional array and list tests
tmiddlet2666 Mar 12, 2020
f74d0db
fixup issue with recursion
tmiddlet2666 Mar 12, 2020
0b85156
enable null serialization
tmiddlet2666 Mar 12, 2020
4c7f13f
add temporary scalar datetime workaround
tmiddlet2666 Mar 13, 2020
0dd8819
add temporary scalar datetime workaround
tmiddlet2666 Mar 13, 2020
c3ce77b
initial addition of mutations
tmiddlet2666 Mar 13, 2020
0e846e3
initial working mutations
tmiddlet2666 Mar 13, 2020
0765455
add temporary readme
tmiddlet2666 Mar 13, 2020
c21d430
add temporary readme
tmiddlet2666 Mar 13, 2020
b77e3f7
add temporary readme
tmiddlet2666 Mar 13, 2020
2ce47da
support Ignore and JsonbTransient annotations
tmiddlet2666 Mar 16, 2020
76e82e6
add support for @Source annotation
tmiddlet2666 Mar 16, 2020
5e3e5fc
add support for @Source annotation - fix bug
tmiddlet2666 Mar 16, 2020
d2dac24
fixup bug in Source annoation
tmiddlet2666 Mar 17, 2020
8e2e775
checkstyle
tmiddlet2666 Mar 17, 2020
bef5d38
add in missed tests for Input annotation
tmiddlet2666 Mar 17, 2020
8711b63
spotbugs
tmiddlet2666 Mar 17, 2020
a28d533
add tests and helpers for number formatting
tmiddlet2666 Mar 18, 2020
048fc83
tck
tmiddlet2666 Mar 18, 2020
086ed00
add method annotation check
tmiddlet2666 Mar 18, 2020
aebfad5
GraphQL TCK tests.
tomas-langer Mar 18, 2020
fc96627
Fix for getResources
tomas-langer Mar 18, 2020
ab00ac4
fixup tck so it runs. Not all tests working
tmiddlet2666 Mar 19, 2020
3179118
initial work on formatting
tmiddlet2666 Mar 20, 2020
a53d003
more work on number formatting
tmiddlet2666 Mar 24, 2020
5880b9d
working on number format
tmiddlet2666 Mar 24, 2020
1f86921
add /graphql/graphql.schema
tmiddlet2666 Mar 25, 2020
5919109
add /graphql/graphql.schema
tmiddlet2666 Mar 25, 2020
5e5c293
ingore fields progress
tmiddlet2666 Mar 30, 2020
f2eea35
working through tck failures
tmiddlet2666 Mar 30, 2020
c948415
progress
tmiddlet2666 Mar 31, 2020
a6a8777
further schema fixes
tmiddlet2666 Mar 31, 2020
65631d9
progress NonNull
tmiddlet2666 Mar 31, 2020
611e1fe
further fixes to nulls and default values
tmiddlet2666 Apr 2, 2020
09068f7
more tck fixes
tmiddlet2666 Apr 2, 2020
bba87d6
fixup setter and getter
tmiddlet2666 Apr 3, 2020
645b090
checkstyle
tmiddlet2666 Apr 3, 2020
dedc6d8
updates to tests
tmiddlet2666 Apr 6, 2020
4744518
progress on default format values
tmiddlet2666 Apr 6, 2020
64558b5
fixup default date/time formats
tmiddlet2666 Apr 9, 2020
289ed86
small refactoring
tmiddlet2666 Apr 16, 2020
867fdae
Dependency convergence + jakarta libraries
tmiddlet2666 Apr 16, 2020
97823f1
checkstyle and copyright update
tmiddlet2666 Apr 16, 2020
b34c418
non null progress
tmiddlet2666 Apr 17, 2020
10878b7
Add checks for NonNull annotations
tmiddlet2666 Apr 20, 2020
49de618
number format progress
tmiddlet2666 Apr 20, 2020
8d9247e
minor
tmiddlet2666 Apr 21, 2020
9a7e1a5
Ensure that a new Query or Mutation cannot override an existing one w…
tmiddlet2666 Apr 21, 2020
3610bd9
exception handling progress
tmiddlet2666 Apr 22, 2020
f10bad0
exception progress
tmiddlet2666 Apr 22, 2020
d1ccc5c
exception fixup
tmiddlet2666 Apr 23, 2020
33b4e16
Validate that a name for a query or mutation does not contain invali…
tmiddlet2666 Apr 23, 2020
a06822b
progress on date/time - tests not working
tmiddlet2666 Apr 24, 2020
cc3ec42
progress
tmiddlet2666 May 7, 2020
9adc352
progress
tmiddlet2666 May 29, 2020
57a9fbd
Fixup Config
tmiddlet2666 Aug 27, 2020
05f8075
work on dates
tmiddlet2666 Aug 31, 2020
6efcd6e
fixup date formatting
tmiddlet2666 Sep 3, 2020
b68d2ec
progress - still issues with argument conversion
tmiddlet2666 Sep 3, 2020
72a54ff
progress
tmiddlet2666 Sep 6, 2020
2997fae
progress
tmiddlet2666 Sep 8, 2020
499ae62
Fixup arrays and revert HelidonDeployableContainer for Tomas
tmiddlet2666 Sep 9, 2020
6f655a9
Graphql tck (#2)
tomas-langer Sep 9, 2020
722e4c8
IT refactoring progress
tmiddlet2666 Sep 10, 2020
186b3de
Fixup failing tests after moving to CDI discovery
tmiddlet2666 Sep 11, 2020
019ff09
progress on tck tests
tmiddlet2666 Sep 11, 2020
8f1eccd
Work through TCK failures
tmiddlet2666 Sep 15, 2020
a17bff7
Fixup handling of Collections - part 1
tmiddlet2666 Sep 15, 2020
bdd9a2f
TCK progress
tmiddlet2666 Sep 16, 2020
6ed519e
Fixup LocalTime
tmiddlet2666 Sep 16, 2020
f92c434
Fixing formatting
tmiddlet2666 Sep 17, 2020
14de75b
progress on Input type conversion
tmiddlet2666 Sep 17, 2020
52aa8ee
progress on tck
tmiddlet2666 Sep 18, 2020
cf806b7
progress
tmiddlet2666 Sep 21, 2020
c195180
progress on object graphs
tmiddlet2666 Sep 21, 2020
6e8e26e
move from Weld to HelidonTest
tmiddlet2666 Sep 22, 2020
a6ad307
progress - some failing tests
tmiddlet2666 Sep 22, 2020
c13e7ce
progress
tmiddlet2666 Sep 22, 2020
60a7aff
re-enabled GraphQLEndpointIT tests
tmiddlet2666 Sep 22, 2020
f03a743
progress
tmiddlet2666 Sep 22, 2020
8781ba6
COH-20749
tmiddlet2666 Sep 23, 2020
42cea9d
fixup enums and more
tmiddlet2666 Sep 23, 2020
8e7c968
progress
tmiddlet2666 Sep 24, 2020
fa4614f
remove relience on jandex for annotation discovery
tmiddlet2666 Sep 25, 2020
07523da
Remove unwanted Jandex bits
tmiddlet2666 Sep 25, 2020
1b044c1
Checkstyle fixes
tmiddlet2666 Sep 25, 2020
890fe30
Fixup empheral port start
tmiddlet2666 Sep 29, 2020
1fbb90b
Fixup location array failure
tmiddlet2666 Sep 30, 2020
51eceb4
progress on arrays
tmiddlet2666 Oct 1, 2020
14c8593
Fixup arrays
tmiddlet2666 Oct 2, 2020
74d5468
Progress. TCK not running
tmiddlet2666 Oct 7, 2020
7f524b9
Before change for date fixes
tmiddlet2666 Oct 8, 2020
6bec90e
Fixup custom scalars
tmiddlet2666 Oct 9, 2020
be64c67
Fixup tck test kidsAges
tmiddlet2666 Oct 13, 2020
5b776cf
additional fix for list Integer
tmiddlet2666 Oct 13, 2020
487bebe
Fixup nulls
tmiddlet2666 Oct 13, 2020
38e84c0
fix getCharacter
tmiddlet2666 Oct 15, 2020
8a91e8d
Error handling fixes
tmiddlet2666 Oct 15, 2020
a284bbf
error handling process
tmiddlet2666 Oct 16, 2020
fa29b59
TCK: Fix Partial Results Errors
tmiddlet2666 Oct 20, 2020
b92b716
code cleanup
tmiddlet2666 Oct 20, 2020
16af224
Move Integration tests to tests/integration/mp-graphql
tmiddlet2666 Oct 20, 2020
c995def
Refactor
tmiddlet2666 Oct 20, 2020
95bf667
minor
tmiddlet2666 Oct 20, 2020
1471438
Fixup how to handle Maps
tmiddlet2666 Oct 26, 2020
1f1383c
Fixup how to handle Maps - 2
tmiddlet2666 Oct 27, 2020
8a6cbcc
findbugs, checkstyle and copyright
tmiddlet2666 Oct 27, 2020
ffe562a
futher updates
tmiddlet2666 Oct 27, 2020
f97a49a
Introduce GraphQLConfigurationException
tmiddlet2666 Oct 27, 2020
54d9f22
updates
tmiddlet2666 Oct 27, 2020
d0b9ef6
change getters/setters to Helidon style
tmiddlet2666 Oct 27, 2020
f10d390
Progress on adding Builders
tmiddlet2666 Oct 27, 2020
20299fa
further work on builders
tmiddlet2666 Oct 28, 2020
1dd371d
formatting
tmiddlet2666 Oct 28, 2020
0562b0c
Remove redudant code
tmiddlet2666 Oct 29, 2020
c1f42d8
Upgrade to microprofile-graphql official 1.0.3 release!
tmiddlet2666 Oct 30, 2020
3e6cf15
Add builders and fix checkstyle
tmiddlet2666 Nov 2, 2020
a83efef
code cleanup
tmiddlet2666 Nov 2, 2020
a12c423
Add message about [][]
tmiddlet2666 Nov 2, 2020
d0737c0
Doco an config
tmiddlet2666 Nov 2, 2020
d0220be
Minor cleanup
tmiddlet2666 Nov 2, 2020
df319f7
Add examples
tmiddlet2666 Nov 3, 2020
ee4cc1b
further example updates
tmiddlet2666 Nov 3, 2020
21508d7
Move example under microprofile
tmiddlet2666 Nov 3, 2020
6751556
Minor
tmiddlet2666 Nov 3, 2020
af5a525
add graphql example under mp
tmiddlet2666 Nov 4, 2020
80ce0bb
update to graphql example
tmiddlet2666 Nov 4, 2020
59225b9
update to graphql example
tmiddlet2666 Nov 4, 2020
ac0e484
update to graphql example
tmiddlet2666 Nov 4, 2020
0f173d0
update to graphql example
tmiddlet2666 Nov 4, 2020
4abb628
cleanup
tmiddlet2666 Nov 4, 2020
657a6cc
Review fixes
tmiddlet2666 Nov 5, 2020
bedba31
Code updates
tmiddlet2666 Nov 5, 2020
31c20a4
further updates
tmiddlet2666 Nov 5, 2020
56d6eb1
minor
tmiddlet2666 Nov 5, 2020
69f4e85
fix copyright
tmiddlet2666 Nov 5, 2020
d0d4c2c
Using web server.
tomas-langer Nov 6, 2020
8bcb580
No beans.xml
tomas-langer Nov 6, 2020
56468be
GraphQL SE.
tomas-langer Nov 7, 2020
4c4f0ba
Native image support.
tomas-langer Nov 7, 2020
8e2c89e
Javadoc fix.
tomas-langer Nov 7, 2020
e89bf0e
TCK fixes.
tomas-langer Nov 9, 2020
464ef2c
TCK fixes.
tomas-langer Nov 9, 2020
bf256e2
Documentation update.
tomas-langer Nov 9, 2020
2b20581
Copyright and checkstyle.
tomas-langer Nov 9, 2020
2948b0b
Minor typo in doc
tmiddlet2666 Nov 12, 2020
1443092
Review feedback
tmiddlet2666 Nov 13, 2020
bb3e6bc
Merge branch 'master' into graphql
tomas-langer Nov 13, 2020
cc8a370
Update pom.xml
tomas-langer Nov 13, 2020
01cc16b
Remove embedded GraphiQL and include instructions in example
tmiddlet2666 Nov 16, 2020
57acb58
Fix checkstyle
tmiddlet2666 Nov 16, 2020
d5829f7
fix copyright
tmiddlet2666 Nov 16, 2020
3273454
Add GraphQL SE example and docs
tmiddlet2666 Nov 17, 2020
9ff0807
fix copyright
tmiddlet2666 Nov 17, 2020
d1e5c66
Reduce warning message to fine
tmiddlet2666 Nov 18, 2020
ad239b6
bump extended scalars version to match graphql-java version
tmiddlet2666 Nov 19, 2020
8b9ba4f
Excluding unwanted transitive dependencies on okhttp and okio
tomas-langer Nov 24, 2020
bb5b0c3
Extra validation on schema generation
tmiddlet2666 Nov 25, 2020
285ecfa
Minor
tmiddlet2666 Nov 26, 2020
fd6265c
Merge branch 'master' into graphql
tomas-langer Dec 2, 2020
989fa65
Updates after review feedback
tmiddlet2666 Dec 3, 2020
f34caa4
Minor mp-graphql example updates
tmiddlet2666 Dec 3, 2020
1be9cf3
Checkstyle.
tomas-langer Dec 3, 2020
32a37fe
Minor doco typo
tmiddlet2666 Dec 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@
<artifactId>helidon-microprofile-cors</artifactId>
<version>${helidon.version}</version>
</dependency>
<!-- graphQL -->
<dependency>
<groupId>io.helidon.graphql</groupId>
<artifactId>helidon-graphql-server</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.graphql</groupId>
<artifactId>helidon-microprofile-graphql-server</artifactId>
<version>${helidon.version}</version>
</dependency>
<!-- media -->
<dependency>
<groupId>io.helidon.media</groupId>
Expand Down
16 changes: 16 additions & 0 deletions common/common/src/main/java/io/helidon/common/FeatureCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ final class FeatureCatalog {
.path("WebServer", "Websocket")
.nativeSupported(true)
.nativeDescription("Server only"));
add("io.helidon.graphql.server",
FeatureDescriptor.builder()
.name("GraphQL")
.description("GraphQL support")
.path("GraphQL")
.nativeDescription("Experimental support, tested on limited use cases")
.flavor(HelidonFlavor.SE)
.experimental(true));

/*
* MP Modules
Expand Down Expand Up @@ -203,6 +211,14 @@ final class FeatureCatalog {
"Fault Tolerance",
"MicroProfile Fault Tolerance spec implementation",
"FT");
add("io.helidon.microprofile.graphql.server",
FeatureDescriptor.builder()
.name("GraphQL")
.description("MicroProfile GraphQL spec implementation")
.path("GraphQL")
.nativeDescription("Experimental support, tested on limited use cases")
.flavor(HelidonFlavor.MP)
.experimental(true));
add("io.helidon.microprofile.grpc.server",
FeatureDescriptor.builder()
.name("gRPC Server")
Expand Down
29 changes: 29 additions & 0 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<version.lib.google-api-client>1.30.11</version.lib.google-api-client>
<version.lib.google-error-prone>2.3.3</version.lib.google-error-prone>
<version.lib.graalvm>20.1.0</version.lib.graalvm>
<version.lib.graphql-java>15.0</version.lib.graphql-java>
<version.lib.graphql-java.extended.scalars>1.0.1</version.lib.graphql-java.extended.scalars>
<version.lib.grpc>1.32.1</version.lib.grpc>
<version.lib.guava>28.1-jre</version.lib.guava>
<version.lib.h2>1.4.199</version.lib.h2>
Expand Down Expand Up @@ -82,6 +84,7 @@
<version.lib.mariadb-java-client>2.6.2</version.lib.mariadb-java-client>
<version.lib.maven-wagon>2.10</version.lib.maven-wagon>
<version.lib.microprofile-config>1.4</version.lib.microprofile-config>
<version.lib.microprofile-graphql>1.0.3</version.lib.microprofile-graphql>
<version.lib.microprofile-health>2.2</version.lib.microprofile-health>
<version.lib.microprofile-jwt>1.1.1</version.lib.microprofile-jwt>
<version.lib.microprofile-metrics-api>2.3.2</version.lib.microprofile-metrics-api>
Expand Down Expand Up @@ -579,6 +582,22 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.graphql</groupId>
<artifactId>microprofile-graphql-api</artifactId>
<version>${version.lib.microprofile-graphql}</version>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.graphql</groupId>
<artifactId>microprofile-graphql-tck</artifactId>
<version>${version.lib.microprofile-graphql}</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.jwt</groupId>
<artifactId>microprofile-jwt-auth-api</artifactId>
Expand Down Expand Up @@ -953,6 +972,16 @@
<artifactId>graal-sdk</artifactId>
<version>${version.lib.graalvm}</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>${version.lib.graphql-java}</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
<version>${version.lib.graphql-java.extended.scalars}</version>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
223 changes: 223 additions & 0 deletions docs/mp/graphql/01_mp_graphql.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2019, 2020 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

///////////////////////////////////////////////////////////////////////////////

= MicroProfile GraphQL
:h1Prefix: MP
:pagename: microprofile-graphql
:description: Helidon GraphQL MicroProfile
:keywords: helidon, graphql, microprofile, micro-profile


The Microprofile GraphQL APIs are an extension to <<microprofile/01_introduction.adoc, Helidon MP>>
to allow building of applications that can expose a GraphQL endpoint and optionally a link:https://github.com/graphql/graphiql[GraphiQL] API.

== About the MicroProfile GraphQL Specification
Helidon MP implements the MicroProfile GraphQL
link:https://github.com/eclipse/microprofile-graphql[spec] version 1.0.3.
tmiddlet2666 marked this conversation as resolved.
Show resolved Hide resolved
The spec prescribes how applications can be built to expose an endpoint for GraphQL.
GraphQL is an open-source data query and manipulation language for APIs,
and a runtime for fulfilling queries with existing data.
It provides an alternative, though not necessarily a replacement for REST.
tmiddlet2666 marked this conversation as resolved.
Show resolved Hide resolved

For more information on GraphQL see https://graphql.org/.

== Maven Coordinates

The <<about/04_managing-dependencies.adoc, Managing Dependencies>> page describes how you
should declare dependency management for Helidon applications. Then declare the following dependency in your project:

[source,xml]
----
<dependency>
<groupId>io.helidon.microprofile.graphql</groupId>
<artifactId>helidon-microprofile-graphql-server</artifactId>
</dependency>
----

== Getting Started

=== Defining your API

The MicroProfile GraphQL specification defines a number of key annotations to be used when writing a GraphQL endpoint:

* `@GraphQLApi` - identifies a CDI Bean as a GraphQL Endpoint
* `@Query` - identifies a method as returning specified fields for an object or collection of entities
* `@Mutation` - identifies a method which creates, deletes or updates entities

NOTE: Please see the link:https://github.com/eclipse/microprofile-graphql[Microprofile GraphQL spec] for the full list of available annotations.

For example, the following defines a GraphQL endpoint with a number of queries and mutations that work
against a fictional `CustomerService` service and `Customer` class.

[source,java]
.Simple ContactGraphQLApi
----
@ApplicationScoped
@org.eclipse.microprofile.graphql.GraphQLApi
public class ContactGraphQLApi {

@Inject
private CustomerService customerService;

@org.eclipse.microprofile.graphql.Query
public Collection<Customer> findAllCustomers() { <1>
return customerService.getAllCustomers();
}

@org.eclipse.microprofile.graphql.Query
public Customer findCustomer(@Name("customerId") int id) { <2>
return customerService.getCustomer(id);
}

@org.eclipse.microprofile.graphql.Query
public Collection<Customer> findCustomersByName(@Name("name") String name) { <3>
return customerService.getAllCustomers(name);
}

@org.eclipse.microprofile.graphql.Mutation
public Contact createCustomer(@Name("customerId") int id, <4>
@Name("name") String name,
@Name("balance") float balance) {
return customerService.createCustomer(id, name, balance);
}
}

public class customer {
private int id;
@NonNull
private String name;
private float balance;

// getters and setters omitted for brevity
}
----

<1> a query with no-arguments that will return all Customers
<2> a query that takes an argument to return a specific Customer
<3> a query that optionally takes a name and returns a collection of Customers
<4> a mutation that creates a Customer and returns the newly created Customer

The above would generate a GraphQL schema as shown below:
[source,graphql]
.Sample GraphQL Schema
----
type Query {
findAllCustomers: [Customer]
findCustomer(customerId: Int!): Customer
findCustomersByName(name: String): [Customers]
}

type Mutation {
createCustomer(customerId: Int!, name: String!, balance: Float!): Customer
}

type Customer {
id: Int!
name: String!
balance: Float
}
----

After application startup, a GraphQL schema will be generated from your annotated API classes
and POJO's and you will be able to access these via the URL's described below.

=== Creating your entry-point

As per the instructions <<mp/introduction/02_microprofile.adoc, here>> ensure you have added a
`src/main/resources/META-INF/beans.xml` file, so the CDI implementation can pick up your classes.

A `Main` class is not needed, you can configure `io.helidon.microprofile.cdi.Main` as the entry point.

Optionally, you can configure a custom entry point (such as when you need custom configuration setup).

[source,java]
.Sample Entry-point
----
public class MyMain {
public static void main(String[] args) {
io.helidon.microprofile.cdi.Main.main(args);
}
}
----

=== Building your application

As part of building your application, you must create a Jandex index
using the `jandex-maven-plugin` for all API and POJO classes that are used.

[source,xml]
.Generate Jandex index
----
<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>1.0.8</version>
tmiddlet2666 marked this conversation as resolved.
Show resolved Hide resolved
<executions>
<execution>
<id>make-index</id>
</execution>
</executions>
</plugin>
----

== Accessing the GraphQL end-points

After starting your application you should see a message similar to the following
indicating the GraphQL application has be started:

[source,bash]
.Sample Startup output
----
[Mon. Nov. 02 14:54:11 AWST 2020] INFO: io.helidon.microprofile.server.ServerCdiExtension addApplication
- Registering JAX-RS Application: GraphQLApplication
----

Once you access the built-in GraphiQL endpoint at `http://host:port/ui` or
using your GraphQL client via the `http://host:port/graphql` end-point a message indicating the
GraphQL Schema has been generated will be displayed as shown if your log level is set to `FINE`:

[source,bash]
.Sample Schema Message
----
[Mon. Nov. 02 14:54:16 AWST 2020] FINE: io.helidon.microprofile.graphql.server.ExecutionContext <init> - Generated schema:
... Schema displayed here
----

.GraphQL UI
image::mp/graphql_01_introduction_graphiql.png[GraphiQL]

== Configuration Options

=== MicroProfile GraphQL
The specification defines the following configuration options:

[cols="2,2,5"]

|===
|key |default value |description

|`mp.graphql.defaultErrorMessage` |`Server Error` |Error message to send to caller in case of error
|`mp.graphql.exceptionsBlackList` |{nbsp} |Array of checked exception classes that should return default error message
|`mp.graphql.exceptionsWhiteList` |{nbsp} |Array of unchecked exception classes that should return message to caller (instead of default error message)

|===

These configuration options are more significant that the configuration options
that can be used to configure GraphQL invocation (see below).

include::../../shared/graphql/configuration.adoc[]
11 changes: 10 additions & 1 deletion docs/mp/introduction/01_introduction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,26 @@ Add support for CORS to your application using a Helidon module.
Defines annotations that improve applications by providing support to handle error conditions (faults).
--

//GraphQL
[CARD]
.GraphQL
[icon=graphic_eq,link=mp/graphql/01_mp_graphql.adoc]
--
Expose GraphQL API using Microprofile GraphQL.
--

//gRPC
[CARD]
.gRPC
[icon=swap_horiz,link=mp/grpc/01_mp_server_side_services.adoc]
--
Build gRPC servers and clients.
--

//Health Checks
[CARD]
.Health Checks
[icon=favorite_outline,link=mp/health/01_introduction.adoc]
[icon=graphic_eq,link=mp/health/01_introduction.adoc]
tmiddlet2666 marked this conversation as resolved.
Show resolved Hide resolved
--
Expose health statuses of your applications.
--
Expand Down
Loading