public abstract class RequestDocumentation extends Object
Modifier and Type | Method and Description |
---|---|
static ParameterDescriptor |
parameterWithName(String name)
Creates a
ParameterDescriptor that describes a request or path parameter
with the given name . |
static Snippet |
pathParameters(Map<String,Object> attributes,
ParameterDescriptor... descriptors)
Returns a
Snippet that will document the path parameters from the API
operation's request. |
static Snippet |
pathParameters(ParameterDescriptor... descriptors)
Returns a
Snippet that will document the path parameters from the API
operation's request. |
static Snippet |
requestParameters(Map<String,Object> attributes,
ParameterDescriptor... descriptors)
Returns a
Snippet that will document the parameters from the API
operation's request. |
static Snippet |
requestParameters(ParameterDescriptor... descriptors)
Returns a
Snippet that will document the parameters from the API
operation's request. |
public static ParameterDescriptor parameterWithName(String name)
ParameterDescriptor
that describes a request or path parameter
with the given name
.name
- The name of the parameterParameterDescriptor
ready for further configurationpublic static Snippet pathParameters(ParameterDescriptor... descriptors)
Snippet
that will document the path parameters from the API
operation's request. The parameters will be documented using the given
descriptors
.
If a parameter is present in the request path, but is not documented by one of the descriptors, a failure will occur when the snippet is invoked. Similarly, if a parameter is documented, is not marked as optional, and is not present in the request path, a failure will also occur.
If you do not want to document a path parameter, a parameter descriptor can be
marked as IgnorableDescriptor.ignored
. This will prevent it from appearing
in the generated snippet while avoiding the failure described above.
descriptors
- the descriptions of the parameters in the request's pathpublic static Snippet pathParameters(Map<String,Object> attributes, ParameterDescriptor... descriptors)
Snippet
that will document the path parameters from the API
operation's request. The given attributes
will be available during snippet
rendering and the parameters will be documented using the given descriptors
.
If a parameter is present in the request path, but is not documented by one of the descriptors, a failure will occur when the snippet is invoked. Similarly, if a parameter is documented, is not marked as optional, and is not present in the request path, a failure will also occur.
If you do not want to document a path parameter, a parameter descriptor can be
marked as IgnorableDescriptor.ignored
. This will prevent it from appearing
in the generated snippet while avoiding the failure described above.
attributes
- the attributesdescriptors
- the descriptions of the parameters in the request's pathpublic static Snippet requestParameters(ParameterDescriptor... descriptors)
Snippet
that will document the parameters from the API
operation's request. The parameters will be documented using the given
descriptors
.
If a parameter is present in the request, but is not documented by one of the descriptors, a failure will occur when the snippet is invoked. Similarly, if a parameter is documented, is not marked as optional, and is not present in the request, a failure will also occur.
If you do not want to document a request parameter, a parameter descriptor can be
marked as IgnorableDescriptor.ignored
. This will prevent it from appearing
in the generated snippet while avoiding the failure described above.
descriptors
- The descriptions of the request's parametersOperationRequest.getParameters()
public static Snippet requestParameters(Map<String,Object> attributes, ParameterDescriptor... descriptors)
Snippet
that will document the parameters from the API
operation's request. The given attributes
will be available during snippet
rendering and the parameters will be documented using the given descriptors
.
If a parameter is present in the request, but is not documented by one of the descriptors, a failure will occur when the snippet is invoked. Similarly, if a parameter is documented, is not marked as optional, and is not present in the request, a failure will also occur.
If you do not want to document a request parameter, a parameter descriptor can be
marked as IgnorableDescriptor.ignored
. This will prevent it from appearing
in the generated snippet while avoiding the failure described above.
attributes
- the attributesdescriptors
- the descriptions of the request's parametersOperationRequest.getParameters()