Class RequestPartsSnippet

java.lang.Object
org.springframework.restdocs.snippet.TemplatedSnippet
org.springframework.restdocs.request.RequestPartsSnippet
All Implemented Interfaces:
Snippet

public class RequestPartsSnippet extends TemplatedSnippet
A Snippet that documents the request parts supported by a RESTful resource.
Since:
1.1.0
Author:
Andy Wilkinson
See Also:
  • Constructor Details

    • RequestPartsSnippet

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

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

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

      protected RequestPartsSnippet(List<RequestPartDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedParts)
      Creates a new RequestPartsSnippet that will document the request's parts using the given descriptors. The given attributes will be included in the model during template rendering. If ignoreUndocumentedParts is true, undocumented parts will be ignored and will not trigger a failure.
      Parameters:
      descriptors - the parameter descriptors
      attributes - the additional attributes
      ignoreUndocumentedParts - whether undocumented parts should be ignored
  • Method Details

    • and

      public final RequestPartsSnippet and(RequestPartDescriptor... additionalDescriptors)
      Returns a new RequestPartsSnippet 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 RequestPartsSnippet and(List<RequestPartDescriptor> additionalDescriptors)
      Returns a new RequestPartsSnippet configured with this snippet's attributes and its descriptors combined with the given additionalDescriptors.
      Parameters:
      additionalDescriptors - the additional descriptors
      Returns:
      the new snippet
    • 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.
      Specified by:
      createModel in class TemplatedSnippet
      Parameters:
      operation - the operation
      Returns:
      the model