Class CliDocumentation

java.lang.Object
org.springframework.restdocs.cli.CliDocumentation

public abstract class CliDocumentation extends Object
Static factory methods for documenting a RESTful API as if it were being driven using a command-line utility such as curl or HTTPie.
Since:
1.1.0
Author:
Andy Wilkinson, Paul-Christian Volkmer, Raman Gupta, Tomasz Kopczynski
  • Method Details

    • curlRequest

      public static Snippet curlRequest()
      Returns a new Snippet that will document the curl request for the API operation.
      Returns:
      the snippet that will document the curl request
    • curlRequest

      public static Snippet curlRequest(Map<String,Object> attributes)
      Returns a new Snippet that will document the curl request for the API operation. The given attributes will be available during snippet generation.
      Parameters:
      attributes - the attributes
      Returns:
      the snippet that will document the curl request
    • curlRequest

      public static Snippet curlRequest(CommandFormatter commandFormatter)
      Returns a new Snippet that will document the curl request for the API operation. The given commandFormatter will be used to format the curl command in the snippet.
      Parameters:
      commandFormatter - the command formatter
      Returns:
      the snippet that will document the curl request
      Since:
      1.2.0
    • curlRequest

      public static Snippet curlRequest(Map<String,Object> attributes, CommandFormatter commandFormatter)
      Returns a new Snippet that will document the curl request for the API operation. The given attributes will be available during snippet generation. The given commandFormatter will be used to format the curl command in the snippet.
      Parameters:
      attributes - the attributes
      commandFormatter - the command formatter
      Returns:
      the snippet that will document the curl request
      Since:
      1.2.0
    • httpieRequest

      public static Snippet httpieRequest()
      Returns a new Snippet that will document the HTTPie request for the API operation.
      Returns:
      the snippet that will document the HTTPie request
    • httpieRequest

      public static Snippet httpieRequest(Map<String,Object> attributes)
      Returns a new Snippet that will document the HTTPie request for the API operation. The given attributes will be available during snippet generation.
      Parameters:
      attributes - the attributes
      Returns:
      the snippet that will document the HTTPie request
    • httpieRequest

      public static Snippet httpieRequest(CommandFormatter commandFormatter)
      Returns a new Snippet that will document the HTTPie request for the API operation. The given commandFormatter will be used to format the HTTPie command in the snippet.
      Parameters:
      commandFormatter - the command formatter
      Returns:
      the snippet that will document the HTTPie request
      Since:
      1.2.0
    • httpieRequest

      public static Snippet httpieRequest(Map<String,Object> attributes, CommandFormatter commandFormatter)
      Returns a new Snippet that will document the HTTPie request for the API operation. The given attributes will be available during snippet generation. The given commandFormatter will be used to format the HTTPie command in the snippet snippet.
      Parameters:
      attributes - the attributes
      commandFormatter - the command formatter
      Returns:
      the snippet that will document the HTTPie request
      Since:
      1.2.0
    • multiLineFormat

      public static CommandFormatter multiLineFormat()
      Creates a new CommandFormatter that produces multi-line output.
      Returns:
      a multi-line CommandFormatter
    • singleLineFormat

      public static CommandFormatter singleLineFormat()
      Creates a new CommandFormatter that produces single-line output.
      Returns:
      a single-line CommandFormatter