Skip to content

Commit 9cb4451

Browse files
committed
Add reference docs section on GraphQlArgumentBinder options
Closes gh-1294
1 parent e17c696 commit 9cb4451

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

spring-graphql-docs/modules/ROOT/pages/controllers.adoc

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,9 @@ nested argument values to invoke the constructors of nested target objects. For
367367
Alternatively, binding can also be done by invoking a default constructor first, and then
368368
applying argument values via setters on the target object.
369369

370-
TIP: If the target object doesn't have setters, and you can't change that, you can
371-
configure the argument binder to fall back on binding via direct field access.
370+
TIP: If the target object doesn't have setters, you can configure the argument binder to
371+
fall back on binding via direct field access, see
372+
xref:controllers.adoc#controllers.schema-mapping.argument.binding[].
372373

373374
By default, if the method parameter name is available, for example with the `-parameters`
374375
compiler flag in Java 8+ or with debugging info from the compiler, it is used to look up
@@ -404,6 +405,25 @@ annotation. For access to the full arguments map, please use
404405
xref:controllers.adoc#controllers.schema-mapping.arguments[`@Arguments`] instead.
405406

406407

408+
[[controllers.schema-mapping.argument.binding]]
409+
==== Argument Binding
410+
411+
Support for `@Argument` binding is provided by `GraphQlArgumentBinder`. This class is
412+
responsible for creating and populating target object from GraphQL argument values.
413+
414+
Argument binding supports several customizations options:
415+
416+
- `nameResolver` -- customize the mapping of GraphQL argument names to Object properties,
417+
which can be useful to deal with naming conventions like the use of "-".
418+
- `fallBackOnDirectFieldAccess` -- falls back to direct field access in case the target
419+
object does not use accessor methods.
420+
- `conversionService` -- used for type conversion where needed.
421+
422+
To customize argument binding, use dedicated properties on `AnnotatedControllerConfigurer`
423+
to set `GraphQlArgumentBinder.Options`.
424+
425+
426+
407427
[[controllers.schema-mapping.argument-value]]
408428
=== `ArgumentValue`
409429

0 commit comments

Comments
 (0)