【发布时间】:2020-02-13 19:27:04
【问题描述】:
如果 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);
}
}
招摇设计
/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'
【问题讨论】: