如何在swagger中将参数默认值放入生成的代码中
生成的代码中没有swagger参数默认值。 例如:如何在swagger中将参数默认值放入生成的代码中,swagger,swagger-ui,swagger-codegen,Swagger,Swagger Ui,Swagger Codegen,生成的代码中没有swagger参数默认值。 例如: paths: /user/refresh.json: post: operationId: refresh description: | By passing in the appropriate options, you can search for available inventory in the system produces: - ap
paths:
/user/refresh.json:
post:
operationId: refresh
description: |
By passing in the appropriate options, you can search for
available inventory in the system
produces:
- application/json
consumes:
- application/x-www-form-urlencoded
parameters:
- name: "RC-App-Key"
in: "header"
description: appkey..
required: true
default: "abc"
type: "string"
生成的代码如下
公共类developersapest{
private final DevelopersApi api = new DevelopersApi();
@Test
public void refreshTest() throws ApiException {
String rcAppKey = null;
Common response = api.refresh(rcAppKey);
// TODO: test validations
}
rcAppKey为空,但我希望它是默认值“abc”,如:
默认值不在生成的代码中,而是在.md文件中,如何将默认值放入代码中?找到解决方案了吗?我也在寻找它。在本例中,参数标记为
required:true
。必需参数。找到解决方案了吗?我也在寻找。在本例中,参数为marked为必需:true
。必需参数。
String rcAppKey = "abc";
Common response = api.refresh(rcAppKey);