Class PathItem

java.lang.Object
org.apache.juneau.bean.openapi3.OpenApiElement
org.apache.juneau.bean.openapi3.PathItem

public class PathItem extends OpenApiElement
Describes the operations available on a single path.

The PathItem Object describes the operations available on a single path. A Path Item may be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.

OpenAPI Specification:

The PathItem Object is composed of the following fields:

  • summary (string) - An optional, string summary, intended to apply to all operations in this path
  • description (string) - An optional, string description, intended to apply to all operations in this path
  • get (Operation) - A definition of a GET operation on this path
  • put (Operation) - A definition of a PUT operation on this path
  • post (Operation) - A definition of a POST operation on this path
  • delete (Operation) - A definition of a DELETE operation on this path
  • options (Operation) - A definition of an OPTIONS operation on this path
  • head (Operation) - A definition of a HEAD operation on this path
  • patch (Operation) - A definition of a PATCH operation on this path
  • trace (Operation) - A definition of a TRACE operation on this path
  • servers (array of Server) - An alternative server array to service all operations in this path
  • parameters (array of Parameter) - A list of parameters that are applicable for all the operations described under this path
Example:

// Construct using SwaggerBuilder. PathItem x = pathItem() .setSummary("User management") .setGet(operation().setSummary("Get users")) .setPost(operation().setSummary("Create user")); // Serialize using JsonSerializer. String json = Json.from(x); // Or just use toString() which does the same as above. json = x.toString();

// Output { "summary": "User management", "get": { "summary": "Get users" }, "post": { "summary": "Create user" } }

See Also:
  • Constructor Details

    • PathItem

      public PathItem()
      Default constructor.
    • PathItem

      public PathItem(PathItem copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The object to copy.
  • Method Details

    • getSummary

      public String getSummary()
      Returns the summary.
      Returns:
      The summary.
    • setSummary

      public PathItem setSummary(String value)
      Sets the summary.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getDescription

      Returns the description.
      Returns:
      The description.
    • setDescription

      public PathItem setDescription(String value)
      Sets the description.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getGet

      public Operation getGet()
      Returns the GET operation.
      Returns:
      The GET operation.
    • setGet

      public PathItem setGet(Operation value)
      Sets the GET operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getPut

      public Operation getPut()
      Returns the PUT operation.
      Returns:
      The PUT operation.
    • setPut

      public PathItem setPut(Operation value)
      Sets the PUT operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getPost

      public Operation getPost()
      Returns the POST operation.
      Returns:
      The POST operation.
    • setPost

      public PathItem setPost(Operation value)
      Sets the POST operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getDelete

      public Operation getDelete()
      Returns the DELETE operation.
      Returns:
      The DELETE operation.
    • setDelete

      public PathItem setDelete(Operation value)
      Sets the DELETE operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getOptions

      Returns the OPTIONS operation.
      Returns:
      The OPTIONS operation.
    • setOptions

      public PathItem setOptions(Operation value)
      Sets the OPTIONS operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getHead

      public Operation getHead()
      Returns the HEAD operation.
      Returns:
      The HEAD operation.
    • setHead

      public PathItem setHead(Operation value)
      Sets the HEAD operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getPatch

      public Operation getPatch()
      Returns the PATCH operation.
      Returns:
      The PATCH operation.
    • setPatch

      public PathItem setPatch(Operation value)
      Sets the PATCH operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getTrace

      public Operation getTrace()
      Returns the TRACE operation.
      Returns:
      The TRACE operation.
    • setTrace

      public PathItem setTrace(Operation value)
      Sets the TRACE operation.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getServers

      public List<Server> getServers()
      Returns the servers list.
      Returns:
      The servers list.
    • setServers

      public PathItem setServers(List<Server> value)
      Sets the servers list.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • getParameters

      Returns the parameters list.
      Returns:
      The parameters list.
    • setParameters

      Sets the parameters list.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • copy

      public PathItem copy()
      Creates a copy of this object.
      Returns:
      A copy of this object.
    • get

      public <T> T get(String property, Class<T> type)
      Description copied from class: OpenApiElement
      Generic property getter.

      Can be used to retrieve non-standard Swagger fields such as "$ref".

      Overrides:
      get in class OpenApiElement
      Type Parameters:
      T - The datatype to cast the value to.
      Parameters:
      property - The property name to retrieve.
      type - The datatype to cast the value to.
      Returns:
      The property value, or null if the property does not exist or is not set.
    • set

      public PathItem set(String property, Object value)
      Description copied from class: OpenApiElement
      Generic property setter.

      Can be used to set non-standard Swagger fields such as "$ref".

      Overrides:
      set in class OpenApiElement
      Parameters:
      property - The property name to set. Must not be null.
      value - The new value for the property.
      Returns:
      This object
    • keySet

      public Set<String> keySet()
      Description copied from class: OpenApiElement
      Returns all the keys on this element.
      Overrides:
      keySet in class OpenApiElement
      Returns:
      All the keys on this element.
      Never null.
    • strict

      public PathItem strict()
      Description copied from class: OpenApiElement
      Sets strict mode on this bean.
      Overrides:
      strict in class OpenApiElement
      Returns:
      This object
    • strict

      public PathItem strict(Object value)
      Description copied from class: OpenApiElement
      Sets strict mode on this bean.
      Overrides:
      strict in class OpenApiElement
      Parameters:
      value - The new value for this property.
      Non-boolean values will be converted to boolean using Boolean.valueOf(value.toString()).
      Can be null (interpreted as false).
      Returns:
      This object