@@ -143,11 +143,11 @@ See xref:controllers.adoc#controllers.schema-mapping.argument[`@Argument`].
143
143
144
144
See xref:controllers.adoc#controllers.schema-mapping.argument[`@Argument`].
145
145
146
- | `FieldValue `
146
+ | `ArgumentValue `
147
147
| For access to a named field argument bound to a higher-level, typed Object along
148
148
with a flag to indicate if the input argument was omitted vs set to `null`.
149
149
150
- See xref:controllers.adoc#controllers.schema-mapping.field -value[`FieldValue `].
150
+ See xref:controllers.adoc#controllers.schema-mapping.argument -value[`ArgumentValue `].
151
151
152
152
| `@Arguments`
153
153
| For access to all field arguments bound to a higher-level, typed Object.
@@ -403,8 +403,8 @@ specified in the annotation, or to the parameter name. For access to the full ar
403
403
map, please use xref:controllers.adoc#controllers.schema-mapping.arguments[`@Arguments`] instead.
404
404
405
405
406
- [[controllers.schema-mapping.fieldvalue ]]
407
- === `FieldValue `
406
+ [[controllers.schema-mapping.argument-value ]]
407
+ === `ArgumentValue `
408
408
409
409
By default, input arguments in GraphQL are nullable and optional, which means an argument
410
410
can be set to the `null` literal, or not provided at all. This distinction is useful for
@@ -414,7 +414,7 @@ there is no way to make such a distinction, because you would get `null` or an e
414
414
`Optional` in both cases.
415
415
416
416
If you want to know not whether a value was not provided at all, you can declare an
417
- `FieldValue ` method parameter, which is a simple container for the resulting value,
417
+ `ArgumentValue ` method parameter, which is a simple container for the resulting value,
418
418
along with a flag to indicate whether the input argument was omitted altogether. You
419
419
can use this instead of `@Argument`, in which case the argument name is determined from
420
420
the method parameter name, or together with `@Argument` to specify the argument name.
@@ -426,31 +426,20 @@ For example:
426
426
@Controller
427
427
public class BookController {
428
428
429
- @QueryMapping
430
- public List<Book> searchBook(@Argument String search, FieldValue<Genre> genre) {
431
- if (!genre.isOmitted()) {
432
- // genre has been set but might hold a "null" value
433
- Genre genreValue = genre.value();
434
- }
435
- }
436
-
437
429
@MutationMapping
438
- public void addBook(@Argument BookInput bookInput) {
439
- FieldValue<String> genre = bookInput.genre();
440
- genre.ifPresent(genre -> {
441
- // ...
442
- });
430
+ public void addBook(ArgumentValue< BookInput> bookInput) {
431
+ if (! bookInput.isOmitted()) {
432
+ BookInput value = bookInput.value();
433
+ // ...
434
+ }
443
435
}
444
436
}
445
437
----
446
438
447
- `FieldValue ` is also supported as a field within the object structure of an `@Argument`
439
+ `ArgumentValue ` is also supported as a field within the object structure of an `@Argument`
448
440
method parameter, either initialized via a constructor argument or via a setter, including
449
441
as a field of an object nested at any level below the top level object.
450
442
451
- This is also supported on the client side with a dedicated Jackson Module,
452
- see the xref:client.adoc#client.fieldvalue[`FieldValue` support for clients] section.
453
-
454
443
455
444
[[controllers.schema-mapping.arguments]]
456
445
=== `@Arguments`
0 commit comments