Я должен вернуть GetPaymentRepsonse и AuthenticationException, если это не удалось для того же метода отдыха, сгенерированного с помощью swaggercodegen.
У меня есть решение типа
default ResponseEntity<?> getPayment(String id,
String agent,
String contact,
String token) {
return new ResponseEntity<PaymentResponse>(HttpStatus.OK);
}
@Override public ResponseEntity<?> getPayment(String id, String agent, String contact, String token) {
try {
........
..........
return paymentReposne;
} else {
throw new AuthenticationException(Enum.SomeException);
}
} catch (AuthenticationException | IOException | TokenServiceException e) {
return UtilClass.someCustomAuthenticationException(e);
}
}
Swagger Design
/v2.0/.../.../....:
get:
operationId: getPayment
tags:
- something
description:
xxx xxx xxx xxxx
parameters:
- $ref: "#/parameters/token"
- $ref: "#/parameters/id"
- $ref: "#/parameters/agent"
- $ref: "#/parameters/contact"
responses:
'200':
description: 'Successful response'
schema:
type: object --->Here i want to give Generic type or ? to support my above code on swagger code generation
'400':
description: 'Bad request parameters'