Class QueryParametersSnippet

All Implemented Interfaces:
Snippet

public class QueryParametersSnippet extends AbstractParametersSnippet
A Snippet that documents the query parameters supported by a RESTful resource.
Since:
3.0.0
Author:
Andy Wilkinson
See Also:
  • Constructor Details

    • QueryParametersSnippet

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

      protected QueryParametersSnippet(List<ParameterDescriptor> descriptors, boolean ignoreUndocumentedParameters)
      Creates a new QueryParametersSnippet that will document the request's query 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
    • QueryParametersSnippet

      protected QueryParametersSnippet(List<ParameterDescriptor> descriptors, Map<String,Object> attributes)
      Creates a new QueryParametersSnippet that will document the request's query 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
    • QueryParametersSnippet

      protected QueryParametersSnippet(List<ParameterDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedParameters)
      Creates a new QueryParametersSnippet that will document the request's query 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 QueryParametersSnippet and(ParameterDescriptor... additionalDescriptors)
      Returns a new QueryParametersSnippet 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 QueryParametersSnippet and(List<ParameterDescriptor> additionalDescriptors)
      Returns a new QueryParametersSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet