This repository was archived by the owner on Mar 16, 2025. It is now read-only.
This repository was archived by the owner on Mar 16, 2025. It is now read-only.
better response type handling #68
Closed
Description
If an api has multiple response content types (success & errors) the java response type of the controller method will be Object
to allow return values with different java types.
If the errors are handled by throwing an exception there is no need to have an Object
response and the controller method could use the type of the success response to improve readability of the interface.
mapping could be like this, using a globally applied option:
# mapping.yaml
openapi-processor-mapping: v2
options:
response-type: all # all (default) or success
or like this, allowing endpoint & endpoint/method configuration:
# mapping.yaml
openapi-processor-mapping: v2
map:
response-type: all # all (default) or success
all
: consider all response types to select the method return type
success
: consider only the success response type, i.e. usually 200