如何将参数默认值放入swagger生成的代码中

时间:2017-10-22 04:52:40

标签: 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:
      - application/json
      consumes: 
      - application/x-www-form-urlencoded
      parameters:
      - name: "RC-App-Key"
        in: "header"
        description: appkey..
        required: true
        default: "abc"
        type: "string"

生成的代码,如

public class DevelopersApiTest {

private final DevelopersApi api = new DevelopersApi();

@Test
public void refreshTest() throws ApiException {
    String rcAppKey = null;
    Common response = api.refresh(rcAppKey);

    // TODO: test validations
}

rcAppKey为null,但我希望它是默认值" abc",如:

String rcAppKey = "abc";
Common response = api.refresh(rcAppKey);

默认值不在生成的代码中,但在.md文件中,如何将默认值放入代码中?

0 个答案:

没有答案
相关问题