Package io.micronaut.gradle.openapi
Class ResponseBodyMappingModel
java.lang.Object
io.micronaut.gradle.openapi.ResponseBodyMappingModel
- All Implemented Interfaces:
Serializable
A model that can be used to specify body mappings during OpenAPI generation.
An equivalent to Micronaut OpenAPI's ResponseBodyMapping but without using classes from that dependency so that we can isolate execution in workers.
- See Also:
-
Constructor Summary
ConstructorDescriptionResponseBodyMappingModel
(String headerName, String mappedBodyType) Create a response body mapping. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
withHeaderName
(String headerName) Specify the name of the response header that triggers mapping.withListWrapper
(boolean isListWrapper) Specify whether the mapped body is a list wrapper.withMappedBodyType
(String mappedBodyType) Specify the fully-qualified name of the body type that will be generated as the response return type in case mapping is triggered.withValidated
(boolean isValidated) Specify whether the mapped response body type required validation.
-
Constructor Details
-
ResponseBodyMappingModel
Create a response body mapping.- Parameters:
headerName
- The response header name that triggers the change of response type.mappedBodyType
- The type in which will be used as the response type. The type must take a single type parameter, which will be the original body. If the value is null, the header will be removed and body not changed.
-
-
Method Details
-
withHeaderName
Specify the name of the response header that triggers mapping.- Parameters:
headerName
- the name- Returns:
- new instance with the updated header name
-
withMappedBodyType
Specify the fully-qualified name of the body type that will be generated as the response return type in case mapping is triggered.- Parameters:
mappedBodyType
- the type- Returns:
- new instance with the updated mapped body type
-
withListWrapper
Specify whether the mapped body is a list wrapper. Then the mapped body type needs to be supplied list items as property- Parameters:
isListWrapper
- whether it is a list wrapper- Returns:
- new instance with the isListWrapper property specified
-
withValidated
Specify whether the mapped response body type required validation.- Parameters:
isValidated
- whether it should be validated- Returns:
- new instance with validation requirement set
-
getHeaderName
-
getMappedBodyType
-
isListWrapper
public boolean isListWrapper() -
isValidated
public boolean isValidated()
-