Top Description Fields Methods
org.eclipse.microprofile.openapi.models.responses

public Interface APIResponses

extends Constructible, Extensible<APIResponses>
Imports
java.util.Map, org.eclipse.microprofile.openapi.models.Constructible, .Extensible

This interface represents the container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
See Also
OpenAPI Specification Responses Object

Field Summary

Modifier and TypeField and Description
public static final String

Method Summary

Modifier and TypeMethod and Description
public APIResponses

Returns:

APIResponses map with the added ApiResponse instance
addAPIResponse
(String
the name of APIResponse (http status code eventually with wildcard or default)
name
,
APIResponse
the APIResponse object to be added to APIResponses map. null values will be rejected (implementation will throw an exception) or ignored.
apiResponse
)

Adds an APIResponse in the format of the name as a key and the item as the value to APIResponses map

public default APIResponses

Returns:

this ApiResponses instance
defaultValue
(APIResponse
the default documentation of responses
defaultValue
)

Sets the default documentation of responses for this instance of ApiResponses and return this instance of ApiResponses.

public default APIResponse

Returns:

the corresponding APIResponse or null.
getAPIResponse
(String
the name of APIResponse (http status code eventually with wildcard or default)
name
)

Returns a APIResponse for a given name.

public Map<String, APIResponse>

Returns:

all responses
getAPIResponses
()

Returns a copy map (potentially immutable) of the APIResponses.

public APIResponse

Returns:

the default documentation of responses
getDefaultValue
()

Returns the default documentation of responses other than the ones declared for specific HTTP response codes in this instance of ApiResponses.

public default boolean

Returns:

a boolean to indicate if the APIResponse is present or not.
hasAPIResponse
(String
the name of APIResponse (http status code eventually with wildcard or default)
name
)

Check whether a APIResponse is present in the map.

public void
removeAPIResponse(String
the name of APIResponse that will be removed (http status code eventually with wildcard or default)
name
)

Removes the given APIResponse to this APIResponses.

public void
setAPIResponses(Map<String, APIResponse>
a map containing all responses. Keys are http statuses code eventually with wildcard or default.
items
)

Set the APIResponses map to this APIResponses

public void
setDefaultValue(APIResponse
the default documentation of responses
defaultValue
)

Sets the default documentation of responses for this instance of ApiResponses.

Inherited from org.eclipse.microprofile.openapi.models.Extensible:
addExtensionextensionsgetExtensionsremoveExtensionsetExtensions

Field Detail

DEFAULTback to summary
public static final String DEFAULT

Method Detail

addAPIResponseback to summary
public APIResponses addAPIResponse(String name, APIResponse apiResponse)

Adds an APIResponse in the format of the name as a key and the item as the value to APIResponses map

Parameters
name:String

the name of APIResponse (http status code eventually with wildcard or default)

apiResponse:APIResponse

the APIResponse object to be added to APIResponses map. null values will be rejected (implementation will throw an exception) or ignored.

Returns:APIResponses

APIResponses map with the added ApiResponse instance

defaultValueback to summary
public default APIResponses defaultValue(APIResponse defaultValue)

Sets the default documentation of responses for this instance of ApiResponses and return this instance of ApiResponses. This will cover all the undeclared responses.

Convenience method that is the same as calling addAPIResponse(String, APIResponse) with default as value for the key.

Parameters
defaultValue:APIResponse

the default documentation of responses

Returns:APIResponses

this ApiResponses instance

getAPIResponseback to summary
public default APIResponse getAPIResponse(String name)

Returns a APIResponse for a given name. This is a convenience method for getAPIResponses().get(name)

Parameters
name:String

the name of APIResponse (http status code eventually with wildcard or default)

Returns:APIResponse

the corresponding APIResponse or null.

getAPIResponsesback to summary
public Map<String, APIResponse> getAPIResponses()

Returns a copy map (potentially immutable) of the APIResponses.

Returns:Map<String, APIResponse>

all responses

getDefaultValueback to summary
public APIResponse getDefaultValue()

Returns the default documentation of responses other than the ones declared for specific HTTP response codes in this instance of ApiResponses.

Convenience method that is the same as calling getAPIResponse(String) on the map with default as value for the key.

Returns:APIResponse

the default documentation of responses

hasAPIResponseback to summary
public default boolean hasAPIResponse(String name)

Check whether a APIResponse is present in the map. This is a convenience method for getAPIResponses().containsKey(name)

Parameters
name:String

the name of APIResponse (http status code eventually with wildcard or default)

Returns:boolean

a boolean to indicate if the APIResponse is present or not.

removeAPIResponseback to summary
public void removeAPIResponse(String name)

Removes the given APIResponse to this APIResponses.

Parameters
name:String

the name of APIResponse that will be removed (http status code eventually with wildcard or default)

setAPIResponsesback to summary
public void setAPIResponses(Map<String, APIResponse> items)

Set the APIResponses map to this APIResponses

Parameters
items:Map<String, APIResponse>

a map containing all responses. Keys are http statuses code eventually with wildcard or default.

setDefaultValueback to summary
public void setDefaultValue(APIResponse defaultValue)

Sets the default documentation of responses for this instance of ApiResponses. This will cover all the undeclared responses.

Convenience method that is the same as calling addAPIResponse(String, APIResponse) with default as value for the key.

Parameters
defaultValue:APIResponse

the default documentation of responses