Class Swagger
See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddConsumes
(MediaType... values) Bean property appender:consumes .addDefinition
(String name, JsonMap schema) Bean property appender:definitions .addParameter
(String name, ParameterInfo parameter) Bean property appender:parameters .Bean property appender:paths .addProduces
(MediaType... values) Adds one or more values to theproduces property.addResponse
(String name, ResponseInfo response) Bean property appender:responses .addSchemes
(String... values) Bean property appender:schemes .addSecurity
(String scheme, String... alternatives) Bean property appender:security .addSecurityDefinition
(String name, SecurityScheme securityScheme) Bean property appender:securityDefinitions .Bean property appender:tags .asJson()
A synonym oftoString()
.copy()
Make a deep copy of this object.<T> T
Resolves a"$ref" tags to nodes in this swagger document.<T> T
Generic property getter.Bean property getter:basePath .Bean property getter:consumes .Bean property getter:definitions .Bean property getter:externalDocs .getHost()
Bean property getter:host .getInfo()
Bean property getter:info .getOperation
(String path, String operation) Shortcut for callinggetPaths().get(path).get(operation); getParameterInfo
(String path, String method, String in, String name) Convenience method for callinggetPath(path).get(method).getParameter(in,name); Bean property getter:parameters .Shortcut for callinggetPaths().get(path); getPaths()
Bean property getter:paths .Bean property getter:produces .getResponseInfo
(String path, String operation, int status) Shortcut for callinggetPaths().get(path).get(operation).getResponse(status); getResponseInfo
(String path, String operation, String status) Shortcut for callinggetPaths().get(path).get(operation).getResponse(status); Bean property getter:responses .Bean property getter:schemes .Bean property getter:security .Bean property getter:securityDefinitions .Bean property getter:swagger .getTags()
Bean property getter:tags .keySet()
Returns all the keys on this element.Generic property setter.setBasePath
(String value) Bean property setter:basePath .setConsumes
(Collection<MediaType> value) Bean property setter:consumes .setConsumes
(MediaType... value) Bean property fluent setter:consumes .setDefinitions
(Map<String, JsonMap> value) Bean property setter:definitions .Bean property setter:externalDocs .Bean property setter:host .Bean property setter:info .setParameters
(Map<String, ParameterInfo> value) Bean property setter:parameters .setPaths
(Map<String, OperationMap> value) Bean property setter:paths .setProduces
(Collection<MediaType> value) Bean property setter:produces .setProduces
(MediaType... value) Bean property fluent setter:produces .setResponses
(Map<String, ResponseInfo> value) Bean property setter:responses .setSchemes
(String... value) Bean property fluent setter:schemes .setSchemes
(Collection<String> value) Bean property setter:schemes .setSecurity
(Collection<Map<String, List<String>>> value) Bean property setter:security .Bean property setter:securityDefinitions .setSwagger
(String value) Bean property setter:swagger .setTags
(Collection<Tag> value) Bean property setter:tags .toString()
-
Field Details
-
NULL
Represents a null swagger
-
-
Constructor Details
-
Swagger
public Swagger()Default constructor. -
Swagger
Copy constructor.- Parameters:
copyFrom
- The object to copy.
-
-
Method Details
-
copy
Make a deep copy of this object.- Returns:
- A deep copy of this object.
-
getBasePath
Bean property getter:basePath .The base path on which the API is served, which is relative to the
host .- Returns:
- The property value, or
null if it is not set.
-
setBasePath
Bean property setter:basePath .The base path on which the API is served, which is relative to the
host .- Parameters:
value
- The new value for this property.
If it is not included, the API is served directly under thehost .
The value MUST start with a leading slash (/).
ThebasePath does not support path templating.
Can benull to unset the property.- Returns:
- This object.
-
getConsumes
Bean property getter:consumes .A list of MIME types the APIs can consume.
- Returns:
- The property value, or
null if it is not set.
-
setConsumes
Bean property setter:consumes .A list of MIME types the APIs can consume.
- Parameters:
value
- The new value for this property.
Value MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
addConsumes
Bean property appender:consumes .A list of MIME types the APIs can consume.
- Parameters:
values
- The values to add to this property.
Values MUST be as described under Swagger Mime Types.
Ignored ifnull .- Returns:
- This object.
-
setConsumes
Bean property fluent setter:consumes .A list of MIME types the APIs can consume.
- Parameters:
value
- The values to set on this property.- Returns:
- This object.
-
getDefinitions
Bean property getter:definitions .An object to hold data types produced and consumed by operations.
- Returns:
- The property value, or
null if it is not set.
-
setDefinitions
Bean property setter:definitions .An object to hold data types produced and consumed by operations.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addDefinition
Bean property appender:definitions .Adds a single value to the
definitions property.- Parameters:
name
- A definition name.schema
- The schema that the name defines.- Returns:
- This object.
-
getExternalDocs
Bean property getter:externalDocs .Additional external documentation.
- Returns:
- The property value, or
null if it is not set.
-
setExternalDocs
Bean property setter:externalDocs .Additional external documentation.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
getHost
Bean property getter:host .The host (name or IP) serving the API.
- Returns:
- The property value, or
null if it is not set.
-
setHost
Bean property setter:host .The host (name or IP) serving the API.
- Parameters:
value
- The new value for this property.
This MUST be the host only and does not include the scheme nor sub-paths.
It MAY include a port.
If the host is not included, the host serving the documentation is to be used (including the port).
The host does not support path templating
Can benull to unset the property.- Returns:
- This object.
-
getInfo
Bean property getter:info .Provides metadata about the API.
- Returns:
- The property value, or
null if it is not set.
-
setInfo
Bean property setter:info .Provides metadata about the API.
- Parameters:
value
- The new value for this property.
Property value is required.- Returns:
- This object.
-
getParameters
Bean property getter:parameters .An object to hold parameters that can be used across operations.
- Returns:
- The property value, or
null if it is not set.
-
setParameters
Bean property setter:parameters .An object to hold parameters that can be used across operations.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addParameter
Bean property appender:parameters .Adds a single value to the
parameter property.- Parameters:
name
- The parameter name.parameter
- The parameter definition.- Returns:
- This object.
-
getPaths
Bean property getter:paths .The available paths and operations for the API.
- Returns:
- The property value, or
null if it is not set.
-
setPaths
Bean property setter:paths .The available paths and operations for the API.
- Parameters:
value
- The new value for this property.
Property value is required.- Returns:
- This object.
-
addPath
Bean property appender:paths .Adds a single value to the
paths property.- Parameters:
path
- The path template.methodName
- The HTTP method name.operation
- The operation that describes the path.- Returns:
- This object.
-
getProduces
Bean property getter:produces .A list of MIME types the APIs can produce.
- Returns:
- The property value, or
null if it is not set.
-
setProduces
Bean property setter:produces .A list of MIME types the APIs can produce.
- Parameters:
value
- The new value for this property.
Value MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
addProduces
Adds one or more values to theproduces property.A list of MIME types the APIs can produce.
- Parameters:
values
- The values to add to this property.
Value MUST be as described under Swagger Mime Types.
Can benull to unset the property.- Returns:
- This object.
-
setProduces
Bean property fluent setter:produces .A list of MIME types the APIs can produce.
- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
getResponses
Bean property getter:responses .An object to hold responses that can be used across operations.
- Returns:
- The property value, or
null if it is not set.
-
setResponses
Bean property setter:responses .An object to hold responses that can be used across operations.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addResponse
Bean property appender:responses .Adds a single value to the
responses property.- Parameters:
name
- The response name.response
- The response definition.- Returns:
- This object.
-
getSchemes
Bean property getter:schemes .The transfer protocol of the API.
- Returns:
- The property value, or
null if it is not set.
-
setSchemes
Bean property setter:schemes .The transfer protocol of the API.
- Parameters:
value
- The new value for this property.
Valid values:"http" "https" "ws" "wss"
Can benull to unset the property.- Returns:
- This object.
-
addSchemes
Bean property appender:schemes .The transfer protocol of the API.
- Parameters:
values
- The values to add to this property.
Valid values:"http" "https" "ws" "wss"
Ignored ifnull .- Returns:
- This object.
-
setSchemes
Bean property fluent setter:schemes .The transfer protocol of the API.
- Parameters:
value
- The new value for this property.
Strings can be JSON arrays.- Returns:
- This object.
-
getSecurity
Bean property getter:security .A declaration of which security schemes are applied for the API as a whole.
- Returns:
- The property value, or
null if it is not set.
-
setSecurity
Bean property setter:security .A declaration of which security schemes are applied for the API as a whole.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addSecurity
Bean property appender:security .Adds a single value to the
securityDefinitions property.- Parameters:
scheme
- The security scheme that applies to this operationalternatives
- The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements).- Returns:
- This object.
-
getSecurityDefinitions
Bean property getter:securityDefinitions .Security scheme definitions that can be used across the specification.
- Returns:
- The property value, or
null if it is not set.
-
setSecurityDefinitions
Bean property setter:securityDefinitions .Security scheme definitions that can be used across the specification.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
addSecurityDefinition
Bean property appender:securityDefinitions .Adds a single value to the
securityDefinitions property.- Parameters:
name
- A security name.securityScheme
- A security schema.- Returns:
- This object.
-
getSwagger
Bean property getter:swagger .Specifies the Swagger Specification version being used.
- Returns:
- The property value, or
null if it is not set.
-
setSwagger
Bean property setter:swagger .Specifies the Swagger Specification version being used.
- Parameters:
value
- The new value for this property.
Property value is required.- Returns:
- This object.
-
getTags
Bean property getter:tags .A list of tags used by the specification with additional metadata.
- Returns:
- The property value, or
null if it is not set.
-
setTags
Bean property setter:tags .A list of tags used by the specification with additional metadata.
- Parameters:
value
- The new value for this property.
The order of the tags can be used to reflect on their order by the parsing tools.
Not all tags that are used by the Operation Object 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.
Can benull to unset the property.- Returns:
- This object.
-
addTags
Bean property appender:tags .A list of tags used by the specification with additional metadata.
- Parameters:
values
- The values to add to this property.
The order of the tags can be used to reflect on their order by the parsing tools.
Not all tags that are used by the Operation Object 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.
Ignored ifnull .- Returns:
- This object.
-
getPath
Shortcut for callinggetPaths().get(path); - Parameters:
path
- The path (e.g."/foo" ).- Returns:
- The operation map for the specified path, or
null if it doesn't exist.
-
getOperation
Shortcut for callinggetPaths().get(path).get(operation); - Parameters:
path
- The path (e.g."/foo" ).operation
- The HTTP operation (e.g."get" ).- Returns:
- The operation for the specified path and operation id, or
null if it doesn't exist.
-
getResponseInfo
Shortcut for callinggetPaths().get(path).get(operation).getResponse(status); - Parameters:
path
- The path (e.g."/foo" ).operation
- The HTTP operation (e.g."get" ).status
- The HTTP response status (e.g."200" ).- Returns:
- The operation for the specified path and operation id, or
null if it doesn't exist.
-
getResponseInfo
Shortcut for callinggetPaths().get(path).get(operation).getResponse(status); - Parameters:
path
- The path (e.g."/foo" ).operation
- The HTTP operation (e.g."get" ).status
- The HTTP response status (e.g."200" ).- Returns:
- The operation for the specified path and operation id, or
null if it doesn't exist.
-
getParameterInfo
Convenience method for callinggetPath(path).get(method).getParameter(in,name); - Parameters:
path
- The HTTP path.method
- The HTTP method.in
- The parameter type.name
- The parameter name.- Returns:
- The parameter information or
null if not found.
-
get
Description copied from class:SwaggerElement
Generic property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
get
in classSwaggerElement
- 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
Description copied from class:SwaggerElement
Generic property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
set
in classSwaggerElement
- Parameters:
property
- The property name to set.value
- The new value for the property.- Returns:
- This object.
-
keySet
Description copied from class:SwaggerElement
Returns all the keys on this element.- Overrides:
keySet
in classSwaggerElement
- Returns:
- All the keys on this element.
Nevernull .
-
asJson
A synonym oftoString()
.- Returns:
- This object serialized as JSON.
-
toString
- Overrides:
toString
in classSwaggerElement
-
findRef
Resolves a"$ref" tags to nodes in this swagger document.- Type Parameters:
T
- The class to convert the reference to.- Parameters:
ref
- The ref tag value.c
- The class to convert the reference to.- Returns:
- The referenced node, or
null if the ref wasnull or empty or not found.
-