@Bean(properties="swagger,info,tags,externalDocs,basePath,schemes,consumes,produces,paths,definitions,parameters,responses,securityDefinitions,security,*") public class Swagger extends SwaggerElement
Modifier and Type | Field and Description |
---|---|
static Swagger |
NULL
Represents a null swagger
|
Constructor and Description |
---|
Swagger() |
Modifier and Type | Method and Description |
---|---|
Swagger |
addConsumes(Collection<MediaType> values)
Adds one or more values to the
|
Swagger |
addDefinitions(Map<String,SchemaInfo> values)
Adds one or more values to the
|
Swagger |
addParameters(Map<String,ParameterInfo> values)
Adds one or more values to the
|
Swagger |
addPaths(Map<String,Map<String,Operation>> values)
Adds one or more values to the
|
Swagger |
addProduces(Collection<MediaType> values)
Adds one or more values to the
|
Swagger |
addResponses(Map<String,ResponseInfo> values)
Adds one or more values to the
|
Swagger |
addSchemes(Collection<String> values)
Adds one or more values to the
|
Swagger |
addSecurity(Collection<Map<String,List<String>>> values)
Adds one or more values to the
|
Swagger |
addSecurityDefinitions(Map<String,SecurityScheme> values)
Adds one or more values to the
|
Swagger |
addTags(Collection<Tag> values)
Adds one or more values to the
|
Swagger |
basePath(Object value)
Same as
setBasePath(String) . |
Swagger |
consumes(Object... values)
Adds one or more values to the
|
Swagger |
definition(String name,
SchemaInfo schema)
Adds a single value to the
|
Swagger |
definitions(Object... values)
Adds one or more values to the
|
Swagger |
externalDocs(Object value)
|
<T> T |
get(String property,
Class<T> type)
Generic property getter.
|
String |
getBasePath()
Bean property getter:
|
List<MediaType> |
getConsumes()
Bean property getter:
|
Map<String,SchemaInfo> |
getDefinitions()
Bean property getter:
|
ExternalDocumentation |
getExternalDocs()
Bean property getter:
|
String |
getHost()
Bean property getter:
|
Info |
getInfo()
Bean property getter:
|
Map<String,ParameterInfo> |
getParameters()
Bean property getter:
|
Map<String,Map<String,Operation>> |
getPaths()
Bean property getter:
|
List<MediaType> |
getProduces()
Bean property getter:
|
Map<String,ResponseInfo> |
getResponses()
Bean property getter:
|
List<String> |
getSchemes()
Bean property getter:
|
List<Map<String,List<String>>> |
getSecurity()
Bean property getter:
|
Map<String,SecurityScheme> |
getSecurityDefinitions()
Bean property getter:
|
String |
getSwagger()
Bean property getter:
|
List<Tag> |
getTags()
Bean property getter:
|
Swagger |
host(Object value)
Same as
setHost(String) . |
Swagger |
info(Object value)
Same as
setInfo(Info) . |
Swagger |
parameter(String name,
ParameterInfo parameter)
Adds a single value to the
|
Swagger |
parameters(Object... values)
Adds one or more values to the
|
Swagger |
path(String path,
String methodName,
Operation operation)
Adds a single value to the
|
Swagger |
paths(Object... values)
Adds one or more values to the
|
Swagger |
produces(Object... values)
Adds one or more values to the
|
Swagger |
response(String name,
ResponseInfo response)
Adds a single value to the
|
Swagger |
responses(Object... values)
Adds one or more values to the
|
Swagger |
schemes(Object... values)
Same as
addSchemes(Collection) . |
Swagger |
securities(Object... values)
Adds one or more values to the
|
Swagger |
security(String scheme,
String... alternatives)
Adds a single value to the
|
Swagger |
securityDefinition(String name,
SecurityScheme securityScheme)
Adds a single value to the
|
Swagger |
securityDefinitions(Object... values)
Adds one or more values to the
|
Swagger |
set(String property,
Object value)
Generic property setter.
|
Swagger |
setBasePath(String value)
Bean property setter:
|
Swagger |
setConsumes(Collection<MediaType> value)
Bean property setter:
|
Swagger |
setDefinitions(Map<String,SchemaInfo> value)
Bean property setter:
|
Swagger |
setExternalDocs(ExternalDocumentation value)
Bean property setter:
|
Swagger |
setHost(String value)
Bean property setter:
|
Swagger |
setInfo(Info value)
Bean property setter:
|
Swagger |
setParameters(Map<String,ParameterInfo> value)
Bean property setter:
|
Swagger |
setPaths(Map<String,Map<String,Operation>> value)
Bean property setter:
|
Swagger |
setProduces(Collection<MediaType> value)
Bean property setter:
|
Swagger |
setResponses(Map<String,ResponseInfo> value)
Bean property setter:
|
Swagger |
setSchemes(Collection<String> value)
Bean property setter:
|
Swagger |
setSecurity(Collection<Map<String,List<String>>> value)
Bean property setter:
|
Swagger |
setSecurityDefinitions(Map<String,SecurityScheme> value)
Bean property setter:
|
Swagger |
setSwagger(String value)
Bean property setter:
|
Swagger |
setTags(Collection<Tag> value)
Bean property setter:
|
Swagger |
swagger(Object value)
Same as
setSwagger(String) . |
Swagger |
tags(Object... values)
Adds one or more values to the
|
String |
toString() |
getExtraProperties, isStrict, strict, strict
public Swagger()
public String getSwagger()
Specifies the Swagger Specification version being used.
It can be used by the Swagger UI and other clients to interpret the API listing.
public Swagger setSwagger(String value)
Specifies the Swagger Specification version being used.
It can be used by the Swagger UI and other clients to interpret the API listing.
value
- The new value for this property.
public Swagger swagger(Object value)
setSwagger(String)
.value
- The new value for this property.
toString()
.
public Info getInfo()
Provides metadata about the API.
The metadata can be used by the clients if needed.
public Swagger setInfo(Info value)
Provides metadata about the API.
The metadata can be used by the clients if needed.
value
- The new value for this property.
public Swagger info(Object value)
setInfo(Info)
.public String getHost()
The host (name or IP) serving the API.
public Swagger setHost(String value)
The host (name or IP) serving the API.
value
- The new value for this property.
public Swagger host(Object value)
setHost(String)
.value
- The new value for this property.
toString()
.
public String getBasePath()
The base path on which the API is served, which is relative to the host
.
public Swagger setBasePath(String value)
The base path on which the API is served, which is relative to the host
.
value
- The new value for this property.
host
.
basePath
does not support path templating.
public Swagger basePath(Object value)
setBasePath(String)
.value
- The new value for this property.
toString()
.
host
.
basePath
does not support path templating.
public List<String> getSchemes()
The transfer protocol of the API.
If the schemes
is not included, the default scheme to be used is the one used to access the Swagger
definition itself.
public Swagger setSchemes(Collection<String> value)
The transfer protocol of the API.
If the schemes
is not included, the default scheme to be used is the one used to access the Swagger
definition itself.
value
- The new value for this property.
public Swagger addSchemes(Collection<String> values)
The transfer protocol of the API.
Values MUST be from the list: schemes
is not included, the default scheme to be used is the one used to access the Swagger
definition itself.
values
- The values to add to this property.
public Swagger schemes(Object... values)
addSchemes(Collection)
.values
- The values to add to this property.
Collection<String>
String
- JSON array representation of Collection<String>
schemes(
String
- Individual values
schemes(
public List<MediaType> getConsumes()
A list of MIME types the APIs can consume.
This is global to all APIs but can be overridden on specific API calls.
public Swagger setConsumes(Collection<MediaType> value)
A list of MIME types the APIs can consume.
This is global to all APIs but can be overridden on specific API calls.
value
- The new value for this property.
public Swagger addConsumes(Collection<MediaType> values)
A list of MIME types the operation can consume.
This overrides the consumes
definition at the Swagger Object.
An empty value MAY be used to clear the global definition.
Value MUST be as described under Mime Types.
values
- The values to add to this property.
public Swagger consumes(Object... values)
values
- The values to add to this property.
MediaType
Collection<MediaType
|String>
String
- JSON array representation of Collection<MediaType
>
consumes(
String
- Individual values
consumes(
public List<MediaType> getProduces()
A list of MIME types the APIs can produce.
This is global to all APIs but can be overridden on specific API calls.
public Swagger setProduces(Collection<MediaType> value)
A list of MIME types the APIs can produce.
This is global to all APIs but can be overridden on specific API calls.
value
- The new value for this property.
public Swagger addProduces(Collection<MediaType> values)
A list of MIME types the APIs can produce.
This is global to all APIs but can be overridden on specific API calls.
values
- The values to add to this property.
public Swagger produces(Object... values)
values
- The values to add to this property.
MediaType
Collection<MediaType
|String>
String
- JSON array representation of Collection<MediaType
>
consumes(
String
- Individual values
consumes(
public Map<String,Map<String,Operation>> getPaths()
The available paths and operations for the API.
public Swagger setPaths(Map<String,Map<String,Operation>> value)
The available paths and operations for the API.
value
- The new value for this property.
public Swagger addPaths(Map<String,Map<String,Operation>> values)
A list of MIME types the APIs can produce.
This is global to all APIs but can be overridden on specific API calls.
values
- The values to add to this property.
public Swagger path(String path, String methodName, Operation operation)
path
- The path template.methodName
- The HTTP method name.operation
- The operation that describes the path.public Swagger paths(Object... values)
values
- The values to add to this property.
Map<String,Map<String,Operation
>|String>
String
- JSON object representation of Map<String,Map<String,Operation
>>
paths(
public Map<String,SchemaInfo> getDefinitions()
An object to hold data types produced and consumed by operations.
public Swagger setDefinitions(Map<String,SchemaInfo> value)
An object to hold data types produced and consumed by operations.
value
- The new value for this property.
public Swagger addDefinitions(Map<String,SchemaInfo> values)
An object to hold data types produced and consumed by operations.
values
- The values to add to this property.
public Swagger definition(String name, SchemaInfo schema)
name
- A definition name.schema
- The schema that the name defines.public Swagger definitions(Object... values)
values
- The values to add to this property.
Map<String,Map<String,SchemaInfo
>|String>
String
- JSON object representation of Map<String,Map<String,SchemaInfo
>>
definitions(
public Map<String,ParameterInfo> getParameters()
An object to hold parameters that can be used across operations.
This property does not define global parameters for all operations.
public Swagger setParameters(Map<String,ParameterInfo> value)
An object to hold parameters that can be used across operations.
This property does not define global parameters for all operations.
value
- The new value for this property.
public Swagger addParameters(Map<String,ParameterInfo> values)
An object to hold parameters that can be used across operations.
This property does not define global parameters for all operations.
values
- The values to add to this property.
public Swagger parameter(String name, ParameterInfo parameter)
name
- The parameter name.parameter
- The parameter definition.public Swagger parameters(Object... values)
values
- The values to add to this property.
Map<String,ParameterInfo
|String>
String
- JSON object representation of Map<String,ParameterInfo
>
parameters(
public Map<String,ResponseInfo> getResponses()
An object to hold responses that can be used across operations.
This property does not define global responses for all operations.
public Swagger setResponses(Map<String,ResponseInfo> value)
An object to hold responses that can be used across operations.
This property does not define global responses for all operations.
value
- The new value for this property.
public Swagger addResponses(Map<String,ResponseInfo> values)
An object to hold responses that can be used across operations.
This property does not define global responses for all operations.
values
- The values to add to this property.
public Swagger response(String name, ResponseInfo response)
name
- The response name.response
- The response definition.public Swagger responses(Object... values)
values
- The values to add to this property.
Map<String,ResponseInfo
|String>
String
- JSON object representation of Map<String,ResponseInfo
>
responses(
public Map<String,SecurityScheme> getSecurityDefinitions()
Security scheme definitions that can be used across the specification.
public Swagger setSecurityDefinitions(Map<String,SecurityScheme> value)
Security scheme definitions that can be used across the specification.
value
- The new value for this property.
public Swagger addSecurityDefinitions(Map<String,SecurityScheme> values)
Security scheme definitions that can be used across the specification.
values
- The values to add to this property.
public Swagger securityDefinition(String name, SecurityScheme securityScheme)
name
- A security name.securityScheme
- A security schema.public Swagger securityDefinitions(Object... values)
values
- The values to add to this property.
Map<String,SecurityScheme
|String>
String
- JSON object representation of Map<String,SecurityScheme
>
securityDefinitions(
public List<Map<String,List<String>>> getSecurity()
A declaration of which security schemes are applied for the API as a whole.
The list of values describes alternative security schemes that can be used (that is, there is a logical OR
between the security requirements).
Individual operations can override this definition.
public Swagger setSecurity(Collection<Map<String,List<String>>> value)
A declaration of which security schemes are applied for the API as a whole.
The list of values describes alternative security schemes that can be used (that is, there is a logical OR
between the security requirements).
Individual operations can override this definition.
value
- The new value for this property.
public Swagger addSecurity(Collection<Map<String,List<String>>> values)
A declaration of which security schemes are applied for the API as a whole.
The list of values describes alternative security schemes that can be used (that is, there is a logical OR
between the security requirements).
Individual operations can override this definition.
values
- The values to add to this property.
public Swagger security(String scheme, String... alternatives)
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).public Swagger securities(Object... values)
values
- The values to add to this property.
Collection<Map<String,List<String>>>
String
- JSON array representation of Collection<Map<String,List<String>>>
securities(
String
- JSON object representation of Map<String,List<String>>
securities(
public List<Tag> getTags()
A list of tags used by the specification with additional metadata.
public Swagger setTags(Collection<Tag> value)
A list of tags used by the specification with additional metadata.
value
- The new value for this property.
public Swagger addTags(Collection<Tag> values)
A list of tags used by the specification with additional metadata.
values
- The values to add to this property.
public Swagger tags(Object... values)
values
- The values to add to this property.
Tag
Collection<Tag
|String>
Tag
[]
String
- JSON array representation of Collection<Tag
>
tags(
String
- JSON object representation of Tag
tags(
public ExternalDocumentation getExternalDocs()
Additional external documentation.
public Swagger setExternalDocs(ExternalDocumentation value)
Additional external documentation.
value
- The new value for this property.
public Swagger externalDocs(Object value)
value
- The new value for this property.
ExternalDocumentation
String
- JSON object representation of ExternalDocumentation
externalDocs(
public <T> T get(String property, Class<T> type)
SwaggerElement
Can be used to retrieve non-standard Swagger fields such as
get
in class SwaggerElement
property
- The property name to retrieve.type
- The datatype to cast the value to.public Swagger set(String property, Object value)
SwaggerElement
Can be used to set non-standard Swagger fields such as
set
in class SwaggerElement
property
- The property name to set.value
- The new value for the property.public String toString()
toString
in class SwaggerElement
Copyright © 2018 Apache. All rights reserved.