You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are pleased to announce the release of graphql-java v21.0! Thanks to everyone in the community who contributed to the release, whether that was code, helping to report issues, or participating in discussions.
8
+
9
+
And a very Happy 8th Birthday to graphql-java, who celebrated their birthday last week!
10
+
11
+
This is a **breaking change** release, including upgrading to Java 11 and changes to `parseValue` coercion. See the full release notes on [GitHub](https://github.com/graphql-java/graphql-java/releases/tag/v21.0).
Copy file name to clipboardExpand all lines: documentation/instrumentation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ GraphQL.newGraphQL(schema)
98
98
``graphql.execution.instrumentation.tracing.TracingInstrumentation`` is an ``Instrumentation`` implementation that creates tracing information
99
99
about the query that is being executed.
100
100
101
-
It follows the Apollo proposed tracing format defined at `https://github.com/apollographql/apollo-tracing <https://github.com/apollographql/apollo-tracing>`_
101
+
It follows the Apollo proposed tracing format defined at [https://github.com/apollographql/apollo-tracing](https://github.com/apollographql/apollo-tracing).
102
102
103
103
A detailed tracing map will be created and placed in the ``extensions`` section of the result.
Copy file name to clipboardExpand all lines: readme.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,8 @@ Then update `lastVersion` inside `docusaurus.config.js`
47
47
lastVersion: "v20",
48
48
```
49
49
50
-
Finally, change the Maven and Gradle sections in [documentation/getting-started.mdx](/documentation/getting-started.mdx) and versioned documentation inside `versioned_docs`.
50
+
Delete the oldest version by deleting the oldest version's directory inside `versioned_docs` and the corresponding file in `versioned_sidebars`. Then delete the oldest version from `versions.json`.
51
+
52
+
Finally, change the Maven and Gradle sections in [documentation/getting-started.mdx](/documentation/getting-started.mdx).
51
53
52
54
For more, see the [Docusaurus versioning documentation](https://docusaurus.io/docs/versioning).
@@ -113,24 +113,9 @@ called ``fieldX`` or a map key called ``fieldX`` if the backing object is a ``Ma
113
113
However you may have small differences between your graphql schema naming and runtime object naming. For example imagine that ``Product.description`` is actually
114
114
represented as ``getDesc()`` in the runtime backing Java object.
115
115
116
-
If you are using SDL to specify your schema then you can use the ``@fetch`` directive to indicate this remapping.
You can specify it directly by wiring in a field data fetcher.
130
117
This will tell the ``graphql.schema.PropertyDataFetcher`` to use the property name ``desc`` when fetching data for the graphql field named ``description``.
131
118
132
-
If you are hand coding your schema then you can just specify it directly by wiring in a field data fetcher.
Copy file name to clipboardExpand all lines: versioned_docs/version-v21/data-mapping.md
+153-2Lines changed: 153 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@ title: "Data mapping"
3
3
date: 2018-09-09T12:52:46+10:00
4
4
description: How graphql-java maps object data to graphql types
5
5
---
6
-
# Mapping data
6
+
# Mapping output data
7
7
8
-
## How graphql maps object data to types
8
+
## How graphql maps object data to output types
9
9
10
10
At its heart graphql is all about declaring a type schema and mapping that over backing runtime data.
11
11
@@ -166,3 +166,154 @@ For every object in the list it will look for an ``id`` field, find it by name i
166
166
response. It does that for every field in the query on that type.
167
167
168
168
By creating a "unified view" at the higher level data fetcher, you have mapped between your runtime view of the data and the graphql schema view of the data.
169
+
170
+
# Mapping input data
171
+
172
+
## How graphql maps object data to input types
173
+
174
+
Input type values are provided to as input to a graphql operation. The three kinds of types that can be input are **Enums**, **Scalars** and **Input Object Types** and the **List** and **Non-Null** variants of these
175
+
type kinds.
176
+
177
+
The following outlines how graphql-java represents these type kinds in JVM runtime terms.
178
+
179
+
### Enums
180
+
181
+
graphql-java maps input `Enum` values by name. When you create the `graphql.schema.GraphQLEnumType` instance you can in theory map a name `java.lang.String`
182
+
to any JVM object. But this is not common at all. Mostly the name of the enum value is the actual value of it.
183
+
184
+
```graphql
185
+
enumRGB {
186
+
RED, BLUE, GREEN
187
+
}
188
+
189
+
scalarPantone
190
+
191
+
typeQuery {
192
+
toPantone( color : RGB) : Pantone
193
+
}
194
+
```
195
+
196
+
The `RGB` enumtype above has the runtime JVM `java.lang.String` values of `"RED"`,`"BLUE"` and `"GREEN"` on input and output.
197
+
198
+
The graphql-java system allow you to also input `java.lang.Enum` but this is not common at all for input. The reason it's not common is that this would
199
+
require you to turn your network input into Java enums and this is not a common action of serialisation frameworks.
200
+
201
+
If the input value to the enum comes from the graphql operation document, then the input value will initially be a `graphql.language.EnumValue` which
202
+
is the AST representation of a graphql `Enum` value. This will be converted by graphql-java to a value by name.
203
+
204
+
So a query document like the following will end up mapping the AST enum input value `RED` to the JVM value `"RED"`.
205
+
206
+
```graphql
207
+
query MyColors {
208
+
toPantone(color : RED)
209
+
}
210
+
```
211
+
212
+
### Scalars
213
+
214
+
The input values to a scalar are controlled by the scalar implementation. If their `graphql.schema.Coercing#parseValue(java.lang.Object, graphql.GraphQLContext, java.util.Locale)` accepts
215
+
a certain value then it's up to them to decide what JVM object is returned by the scalar code.
216
+
217
+
The graphql-java scalars will return the following values as JVM object input values.
218
+
219
+
***String** aka ``GraphQLString`` - will produce a `java.lang.String`
220
+
***Boolean** aka ``GraphQLBoolean`` - will produce a `java.lang.Boolean`
221
+
***Int** aka ``GraphQLInt`` - will produce a `java.lang.Integer`
222
+
***Float** aka ``GraphQLFloat`` - will produce a `java.lang.Double`
223
+
***ID** aka ``GraphQLID`` - will produce a `java.lang.String`
224
+
225
+
### Input Object Types
226
+
227
+
Input object types are complex input types with named input fields. The runtime JVM representation will be a `java.util.Map`. Specifically
0 commit comments