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,
Map<String,Object> attributes)
Creates a new
ResponseFieldsSnippet that will document the fields in the
response using the given descriptors . |
Modifier and Type | Method and Description |
---|---|
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 . |
createModel, createModelForDescriptor, getFieldDescriptors
document, getAttributes, getSnippetName
protected ResponseFieldsSnippet(List<FieldDescriptor> descriptors)
ResponseFieldsSnippet
that will document the fields in the
response using the given descriptors
.descriptors
- the descriptorsprotected 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.descriptors
- the descriptorsattributes
- the additional attributesprotected MediaType getContentType(Operation operation)
AbstractFieldsSnippet
operation
.getContentType
in class AbstractFieldsSnippet
operation
- The operationprotected byte[] getContent(Operation operation) throws IOException
AbstractFieldsSnippet
operation
.getContent
in class AbstractFieldsSnippet
operation
- The operationIOException
- if the content cannot be extracted