Package io.muserver.openapi
Class OperationObjectBuilder
- java.lang.Object
-
- io.muserver.openapi.OperationObjectBuilder
-
public class OperationObjectBuilder extends java.lang.Object
Describes a single API operation on a path.
-
-
Constructor Summary
Constructors Constructor Description OperationObjectBuilder()
-
Method Summary
-
-
-
Method Detail
-
withTags
public OperationObjectBuilder withTags(java.util.List<java.lang.String> tags)
- Parameters:
tags
- A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.- Returns:
- The current builder
-
withSummary
public OperationObjectBuilder withSummary(java.lang.String summary)
- Parameters:
summary
- A short summary of what the operation does.- Returns:
- The current builder
-
withDescription
public OperationObjectBuilder withDescription(java.lang.String description)
- Parameters:
description
- A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.- Returns:
- The current builder
-
withExternalDocs
public OperationObjectBuilder withExternalDocs(ExternalDocumentationObject externalDocs)
- Parameters:
externalDocs
- Additional external documentation for this operation.- Returns:
- The current builder
-
withOperationId
public OperationObjectBuilder withOperationId(java.lang.String operationId)
- Parameters:
operationId
- Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.- Returns:
- The current builder
-
withParameters
public OperationObjectBuilder withParameters(java.util.List<ParameterObject> parameters)
- Parameters:
parameters
- A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location.- Returns:
- The current builder
-
withRequestBody
public OperationObjectBuilder withRequestBody(RequestBodyObject requestBody)
- Parameters:
requestBody
- The request body applicable for this operation. TherequestBody
is only supported in HTTP methods where the HTTP 1.1 specification RFC7231 has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague,requestBody
SHALL be ignored by consumers.- Returns:
- The current builder
-
withResponses
public OperationObjectBuilder withResponses(ResponsesObject responses)
- Parameters:
responses
- REQUIRED. The list of possible responses as they are returned from executing this operation.- Returns:
- The current builder
-
withCallbacks
public OperationObjectBuilder withCallbacks(java.util.Map<java.lang.String,CallbackObject> callbacks)
- Parameters:
callbacks
- A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for theCallbackObject
. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.- Returns:
- The current builder
-
withDeprecated
public OperationObjectBuilder withDeprecated(java.lang.Boolean deprecated)
- Parameters:
deprecated
- Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value isfalse
.- Returns:
- The current builder
-
withSecurity
public OperationObjectBuilder withSecurity(java.util.List<SecurityRequirementObject> security)
- Parameters:
security
- A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.- Returns:
- The current builder
-
withServers
public OperationObjectBuilder withServers(java.util.List<ServerObject> servers)
- Parameters:
servers
- An alternativeserver
array to service this operation. If an alternativeserver
object is specified at the Path Item Object or Root level, it will be overridden by this value.- Returns:
- The current builder
-
build
public OperationObject build()
- Returns:
- A new object
-
operationObject
public static OperationObjectBuilder operationObject()
Creates a builder for aOperationObject
- Returns:
- A new builder
-
builderFrom
public static OperationObjectBuilder builderFrom(OperationObject operation)
Creates a builder from the given operation object- Parameters:
operation
- The object to copy values from- Returns:
- An operation object builder
-
-