public abstract class PayloadDocumentation extends Object
Modifier and Type | Method and Description |
---|---|
static FieldSnippetResultHandler |
documentRequestFields(String outputDir,
FieldDescriptor... descriptors)
Creates a
RequestFieldsSnippetResultHandler that will produce a
documentation snippet for a request's fields. |
static FieldSnippetResultHandler |
documentResponseFields(String outputDir,
FieldDescriptor... descriptors)
Creates a
ResponseFieldsSnippetResultHandler that will produce a
documentation snippet for a response's fields. |
static FieldDescriptor |
fieldWithPath(String path)
Creates a
FieldDescriptor that describes a field with the given
path . |
public static FieldDescriptor fieldWithPath(String path)
FieldDescriptor
that describes a field with the given
path
.
The path
uses '.' to descend into a child object and ' []
' to
descend into an array. For example, with this JSON payload:
{ "a":{ "b":[ { "c":"one" }, { "c":"two" }, { "d":"three" } ] } }The following paths are all present:
Path | Value |
---|---|
a |
An object containing "b" |
a.b |
An array containing three objects |
a.b[] |
An array containing three objects |
a.b[].c |
An array containing the strings "one" and "two" |
a.b[].d |
The string "three" |
path
- The path of the fieldFieldDescriptor
ready for further configurationRestDocumentationResultHandler.withRequestFields(FieldDescriptor...)
,
RestDocumentationResultHandler.withResponseFields(FieldDescriptor...)
public static FieldSnippetResultHandler documentRequestFields(String outputDir, FieldDescriptor... descriptors)
RequestFieldsSnippetResultHandler
that will produce a
documentation snippet for a request's fields.outputDir
- The directory to which the snippet should be writtendescriptors
- The descriptions of the request's fieldsRestDocumentationResultHandler.withRequestFields(FieldDescriptor...)
public static FieldSnippetResultHandler documentResponseFields(String outputDir, FieldDescriptor... descriptors)
ResponseFieldsSnippetResultHandler
that will produce a
documentation snippet for a response's fields.outputDir
- The directory to which the snippet should be writtendescriptors
- The descriptions of the response's fieldsRestDocumentationResultHandler.withResponseFields(FieldDescriptor...)