Class FormParametersSnippet

All Implemented Interfaces:
Snippet

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

    • FormParametersSnippet

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

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

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

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