Class FormParametersSnippet
java.lang.Object
org.springframework.restdocs.snippet.TemplatedSnippet
org.springframework.restdocs.request.AbstractParametersSnippet
org.springframework.restdocs.request.FormParametersSnippet
- All Implemented Interfaces:
Snippet
A
Snippet
that documents the form parameters supported by a RESTful resource.- Since:
- 3.0.0
- Author:
- Andy Wilkinson
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
FormParametersSnippet
(List<ParameterDescriptor> descriptors) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
.protected
FormParametersSnippet
(List<ParameterDescriptor> descriptors, boolean ignoreUndocumentedParameters) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
.protected
FormParametersSnippet
(List<ParameterDescriptor> descriptors, Map<String, Object> attributes) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
.protected
FormParametersSnippet
(List<ParameterDescriptor> descriptors, Map<String, Object> attributes, boolean ignoreUndocumentedParameters) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
. -
Method Summary
Modifier and TypeMethodDescriptionand
(List<ParameterDescriptor> additionalDescriptors) Returns a newFormParametersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.and
(ParameterDescriptor... additionalDescriptors) Returns a newFormParametersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.extractActualParameters
(Operation operation) Extracts the names of the parameters that were present in the givenoperation
.protected void
verificationFailed
(Set<String> undocumentedParameters, Set<String> missingParameters) Called when the documented parameters do not match the actual parameters.Methods inherited from class org.springframework.restdocs.request.AbstractParametersSnippet
createModel, createModelForDescriptor, getParameterDescriptors, isIgnoreUndocumentedParameters
Methods inherited from class org.springframework.restdocs.snippet.TemplatedSnippet
document, getAttributes, getSnippetName
-
Constructor Details
-
FormParametersSnippet
Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
. Undocumented parameters will trigger a failure.- Parameters:
descriptors
- the parameter descriptors
-
FormParametersSnippet
protected FormParametersSnippet(List<ParameterDescriptor> descriptors, boolean ignoreUndocumentedParameters) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
. IfignoreUndocumentedParameters
istrue
, undocumented parameters will be ignored and will not trigger a failure.- Parameters:
descriptors
- the parameter descriptorsignoreUndocumentedParameters
- whether undocumented parameters should be ignored
-
FormParametersSnippet
protected FormParametersSnippet(List<ParameterDescriptor> descriptors, Map<String, Object> attributes) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
. The givenattributes
will be included in the model during template rendering. Undocumented parameters will trigger a failure.- Parameters:
descriptors
- the parameter descriptorsattributes
- the additional attributes
-
FormParametersSnippet
protected FormParametersSnippet(List<ParameterDescriptor> descriptors, Map<String, Object> attributes, boolean ignoreUndocumentedParameters) Creates a newFormParametersSnippet
that will document the request's form parameters using the givendescriptors
. The givenattributes
will be included in the model during template rendering. IfignoreUndocumentedParameters
istrue
, undocumented parameters will be ignored and will not trigger a failure.- Parameters:
descriptors
- the parameter descriptorsattributes
- the additional attributesignoreUndocumentedParameters
- whether undocumented parameters should be ignored
-
-
Method Details
-
verificationFailed
protected void verificationFailed(Set<String> undocumentedParameters, Set<String> missingParameters) Description copied from class:AbstractParametersSnippet
Called when the documented parameters do not match the actual parameters.- Specified by:
verificationFailed
in classAbstractParametersSnippet
- Parameters:
undocumentedParameters
- the parameters that were found in the operation but were not documentedmissingParameters
- the parameters that were documented but were not found in the operation
-
extractActualParameters
Description copied from class:AbstractParametersSnippet
Extracts the names of the parameters that were present in the givenoperation
.- Specified by:
extractActualParameters
in classAbstractParametersSnippet
- Parameters:
operation
- the operation- Returns:
- the parameters
-
and
Returns a newFormParametersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.- Parameters:
additionalDescriptors
- the additional descriptors- Returns:
- the new snippet
-
and
Returns a newFormParametersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.- Parameters:
additionalDescriptors
- the additional descriptors- Returns:
- the new snippet
-