Class PathParametersSnippet

All Implemented Interfaces:
Snippet

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

    • PathParametersSnippet

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

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

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

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

    • createModel

      protected Map<String,Object> createModel(Operation operation)
      Description copied from class: TemplatedSnippet
      Create the model that should be used during template rendering to document the given operation. Any additional attributes that were supplied when this TemplatedSnippet were created will be automatically added to the model prior to rendering.
      Overrides:
      createModel in class AbstractParametersSnippet
      Parameters:
      operation - the operation
      Returns:
      the model
    • 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
    • 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
    • and

      public final PathParametersSnippet and(ParameterDescriptor... additionalDescriptors)
      Returns a new PathParametersSnippet 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 final PathParametersSnippet and(List<ParameterDescriptor> additionalDescriptors)
      Returns a new PathParametersSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet