Class RequestParametersSnippet

All Implemented Interfaces:
Snippet

public class RequestParametersSnippet extends AbstractParametersSnippet
A Snippet that documents the request parameters supported by a RESTful resource.

Request parameters are sent as part of the query string or as POSTed form data.

Author:
Andy Wilkinson
See Also:
  • Constructor Details

    • RequestParametersSnippet

      protected RequestParametersSnippet(List<ParameterDescriptor> descriptors)
      Creates a new RequestParametersSnippet that will document the request's parameters using the given descriptors. Undocumented parameters will trigger a failure.
      Parameters:
      descriptors - the parameter descriptors
    • RequestParametersSnippet

      protected RequestParametersSnippet(List<ParameterDescriptor> descriptors, boolean ignoreUndocumentedParameters)
      Creates a new RequestParametersSnippet that will document the request's parameters using the given descriptors. If ignoreUndocumentedParameters is true, undocumented parameters will be ignored and will not trigger a failure.
      Parameters:
      descriptors - the parameter descriptors
      ignoreUndocumentedParameters - whether undocumented parameters should be ignored
    • RequestParametersSnippet

      protected RequestParametersSnippet(List<ParameterDescriptor> descriptors, Map<String,Object> attributes)
      Creates a new RequestParametersSnippet that will document the request's parameters using the given descriptors. The given attributes will be included in the model during template rendering. Undocumented parameters will trigger a failure.
      Parameters:
      descriptors - the parameter descriptors
      attributes - the additional attributes
    • RequestParametersSnippet

      protected RequestParametersSnippet(List<ParameterDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedParameters)
      Creates a new RequestParametersSnippet that will document the request's parameters using the given descriptors. The given attributes will be included in the model during template rendering. If ignoreUndocumentedParameters is true, undocumented parameters will be ignored and will not trigger a failure.
      Parameters:
      descriptors - the parameter descriptors
      attributes - the additional attributes
      ignoreUndocumentedParameters - 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 class AbstractParametersSnippet
      Parameters:
      undocumentedParameters - the parameters that were found in the operation but were not documented
      missingParameters - the parameters that were documented but were not found in the operation
    • extractActualParameters

      protected Set<String> extractActualParameters(Operation operation)
      Description copied from class: AbstractParametersSnippet
      Extracts the names of the parameters that were present in the given operation.
      Specified by:
      extractActualParameters in class AbstractParametersSnippet
      Parameters:
      operation - the operation
      Returns:
      the parameters
    • and

      public RequestParametersSnippet and(ParameterDescriptor... additionalDescriptors)
      Returns a new RequestParametersSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet
    • and

      public RequestParametersSnippet and(List<ParameterDescriptor> additionalDescriptors)
      Returns a new RequestParametersSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet