Package io.muserver.openapi
Class OpenAPIObjectBuilder
- java.lang.Object
-
- io.muserver.openapi.OpenAPIObjectBuilder
-
public class OpenAPIObjectBuilder extends java.lang.Object
This is the root document object of the OpenAPI document.
-
-
Constructor Summary
Constructors Constructor Description OpenAPIObjectBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenAPIObject
build()
static OpenAPIObjectBuilder
openAPIObject()
Creates a builder for anOpenAPIObject
OpenAPIObjectBuilder
withComponents(ComponentsObject components)
OpenAPIObjectBuilder
withExternalDocs(ExternalDocumentationObject externalDocs)
OpenAPIObjectBuilder
withInfo(InfoObject info)
OpenAPIObjectBuilder
withPaths(PathsObject paths)
OpenAPIObjectBuilder
withSecurity(java.util.List<SecurityRequirementObject> security)
OpenAPIObjectBuilder
withServers(java.util.List<ServerObject> servers)
OpenAPIObjectBuilder
withTags(java.util.List<TagObject> tags)
-
-
-
Method Detail
-
withInfo
public OpenAPIObjectBuilder withInfo(InfoObject info)
- Parameters:
info
- REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.- Returns:
- The current builder
-
withServers
public OpenAPIObjectBuilder withServers(java.util.List<ServerObject> servers)
- Parameters:
servers
- An array of Server Objects, which provide connectivity information to a target server. If theservers
property is not provided, or is an empty array, the default value would be aServerObject
with aurl
value of/
.- Returns:
- The current builder
-
withPaths
public OpenAPIObjectBuilder withPaths(PathsObject paths)
- Parameters:
paths
- REQUIRED. The available paths and operations for the API.- Returns:
- The current builder
-
withComponents
public OpenAPIObjectBuilder withComponents(ComponentsObject components)
- Parameters:
components
- An element to hold various schemas for the specification.- Returns:
- The current builder
-
withSecurity
public OpenAPIObjectBuilder withSecurity(java.util.List<SecurityRequirementObject> security)
- Parameters:
security
- A declaration of which security mechanisms can be used across the API. 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. Individual operations can override this definition.- Returns:
- The current builder
-
withTags
public OpenAPIObjectBuilder withTags(java.util.List<TagObject> tags)
- Parameters:
tags
- A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by theOperationObject
must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.- Returns:
- The current builder
-
withExternalDocs
public OpenAPIObjectBuilder withExternalDocs(ExternalDocumentationObject externalDocs)
- Parameters:
externalDocs
- Additional external documentation.- Returns:
- The current builder
-
build
public OpenAPIObject build()
- Returns:
- A new object
-
openAPIObject
public static OpenAPIObjectBuilder openAPIObject()
Creates a builder for anOpenAPIObject
- Returns:
- A new builder
-
-