public class ResponseFieldsSnippet extends AbstractFieldsSnippet
Snippet that documents the fields in a response.PayloadDocumentation.responseFields(FieldDescriptor...),
PayloadDocumentation.responseFields(Map, FieldDescriptor...)| Modifier | Constructor and Description |
|---|---|
protected |
ResponseFieldsSnippet(List<FieldDescriptor> descriptors)
Creates a new
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. |
protected |
ResponseFieldsSnippet(List<FieldDescriptor> descriptors,
boolean ignoreUndocumentedFields)
Creates a new
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. |
protected |
ResponseFieldsSnippet(List<FieldDescriptor> descriptors,
Map<String,Object> attributes)
Creates a new
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. |
protected |
ResponseFieldsSnippet(List<FieldDescriptor> descriptors,
Map<String,Object> attributes,
boolean ignoreUndocumentedFields)
Creates a new
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. |
| Modifier and Type | Method and Description |
|---|---|
ResponseFieldsSnippet |
and(FieldDescriptor... additionalDescriptors)
Returns a new
ResponseFieldsSnippet configured with this snippet's
attributes and its descriptors combined with the given
additionalDescriptors. |
ResponseFieldsSnippet |
andWithPrefix(String pathPrefix,
FieldDescriptor... additionalDescriptors)
Returns a new
ResponseFieldsSnippet configured with this snippet's
attributes and its descriptors combined with the given
additionalDescriptors. |
protected byte[] |
getContent(Operation operation)
Returns the content of the request or response extracted form the given
operation. |
protected MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation. |
applyPathPrefix, createModel, createModelForDescriptor, getFieldDescriptorsdocument, getAttributes, getSnippetNameprotected ResponseFieldsSnippet(List<FieldDescriptor> descriptors)
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. Undocumented fields will trigger a
failure.descriptors - the descriptorsprotected ResponseFieldsSnippet(List<FieldDescriptor> descriptors, boolean ignoreUndocumentedFields)
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. If ignoreUndocumentedFields
is true, undocumented fields will be ignored and will not trigger a
failure.descriptors - the descriptorsignoreUndocumentedFields - whether undocumented fields should be ignoredprotected ResponseFieldsSnippet(List<FieldDescriptor> descriptors, Map<String,Object> attributes)
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. The given attributes will be
included in the model during template rendering. Undocumented fields will trigger a
failure.descriptors - the descriptorsattributes - the additional attributesprotected ResponseFieldsSnippet(List<FieldDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedFields)
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors. The given attributes will be
included in the model during template rendering. If
ignoreUndocumentedFields is true, undocumented fields will be
ignored and will not trigger a failure.descriptors - the descriptorsattributes - the additional attributesignoreUndocumentedFields - whether undocumented fields should be ignoredprotected MediaType getContentType(Operation operation)
AbstractFieldsSnippetoperation.getContentType in class AbstractFieldsSnippetoperation - The operationprotected byte[] getContent(Operation operation) throws IOException
AbstractFieldsSnippetoperation.getContent in class AbstractFieldsSnippetoperation - The operationIOException - if the content cannot be extractedpublic ResponseFieldsSnippet and(FieldDescriptor... additionalDescriptors)
ResponseFieldsSnippet configured with this snippet's
attributes and its descriptors combined with the given
additionalDescriptors.additionalDescriptors - the additional descriptorspublic ResponseFieldsSnippet andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors)
ResponseFieldsSnippet configured with this snippet's
attributes and its descriptors combined with the given
additionalDescriptors. The given pathPrefix is applied to the path
of each additional descriptor.pathPrefix - the prefix to apply to the additional descriptorsadditionalDescriptors - the additional descriptors