Interface OpenApiOperationBuilder


public interface OpenApiOperationBuilder
Used by routes to configure OpenApi OperationObjects.

See https://spec.openapis.org/oas/v3.1.0#operationObject

  • Method Details

    • summary

      OpenApiOperationBuilder summary(String summary)
      A short summary of the operation.
    • description

      OpenApiOperationBuilder description(String description)
      A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
    • tag

      OpenApiOperationBuilder tag(@Nullable String tag)
      Adds a tag to the operation. Tags can be used for logical grouping of operations by resources or any other qualifier. Null values will be ignored.
    • deprecated

      Sets deprecated=true
    • externalDocs

      OpenApiOperationBuilder externalDocs(ExternalDocumentationObject externalDocumentationObject)
      Additional external documentation for this operation.
    • pathParameter

      default OpenApiOperationBuilder pathParameter(String name, String description, JsonType type)
      Creates a parameter with the following settings:
           {
               name: ${name},
               description: ${description},
               in: "path",
               required: true,
               style: "simple",
               explode: false,
               schema: {
                   type: ${type}
               }
           }
       
    • pathParameter

      default OpenApiOperationBuilder pathParameter(String name, String description, JsonType type, @Nullable com.inductiveautomation.ignition.common.gson.JsonElement example)
      Creates a parameter with the following settings:
           {
               name: ${name},
               description: ${description},
               in: "path",
               required: true,
               style: "simple",
               explode: false,
               schema: {
                   type: ${type},
                   example: ${example}
               }
           }
       
    • pathParameter

      OpenApiOperationBuilder pathParameter(String name, String description, boolean required, JsonType type, @Nullable com.inductiveautomation.ignition.common.gson.JsonElement example)
      Creates a parameter with the following settings:
           {
               name: ${name},
               description: ${description},
               in: "path",
               required: ${required},
               style: "simple",
               explode: false,
               schema: {
                   type: ${type},
                   example: ${example}
               }
           }
       
    • refParameter

      OpenApiOperationBuilder refParameter(String ref)
      Creates a parameter that uses a reference to a parameter defined in the ComponentsObject.
    • queryParameter

      OpenApiOperationBuilder queryParameter(String name, String description, boolean required, JsonType type, @Nullable com.inductiveautomation.ignition.common.gson.JsonElement example)
      Creates a parameter with the following settings:
           {
               name: ${name},
               description: ${description},
               in: "query",
               required: ${required},
               style: "form",
               explode: true,
               schema: {
                   type: ${type},
                   example: ${example}
               }
           }
       
    • requestBody

      OpenApiOperationBuilder requestBody(String description, boolean required, String contentType, com.inductiveautomation.ignition.common.gson.JsonObject schema)
      For POST and PUT operations, define the shape of the expected request body.
      Parameters:
      description - A brief description of the request body.
      required - Whether the request body is required.
      contentType - The content type of the request body.
      schema - The schema of the request body.
    • requestBody

      OpenApiOperationBuilder requestBody(String description, boolean required, String contentType, com.inductiveautomation.ignition.common.gson.JsonObject schema, @Nullable com.inductiveautomation.ignition.common.gson.JsonElement example)
    • requestBody

      OpenApiOperationBuilder requestBody(RequestBodyObject requestBody)
    • parameter

    • response

      OpenApiOperationBuilder response(int httpStatusCode, String description)
      Adds a response with only a description. For example:
           builder.response(404, "Item not found");
       
    • response

      OpenApiOperationBuilder response(int httpStatusCode, String description, String contentType, com.inductiveautomation.ignition.common.gson.JsonObject schema)
      Adds a response with a content type and schema. For example:
           builder.response(200,
                            "Success. Returns an object with 'itemId' and 'description'.",
                            "application/json",
                            JsonParser.parseString(
                                """
                                {
                                    type: "object",
                                    properties: {
                                        itemId: { type: "string", example: "ABC-123" },
                                        description: { type: "string", example: "lorem ipsum..." }
                                    }
                                }
                                """)
                            );
       
    • response

      OpenApiOperationBuilder response(int httpStatusCode, ResponseObject response)
      Adds an arbitrary ResponseObject to the operation. Use a negative number for the httpStatusCode to store the response as the default response.