Skip to content

how to put parameter default value into generated code in swagger #6782

Closed
@wangyiran125

Description

@wangyiran125

swagger parameter default is not in generated code. for example:

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"

the generated code like

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

}
the rcAppKey is null,but i want it be the default value "abc",like:

String rcAppKey = "abc";
Common response = api.refresh(rcAppKey);
the default value is not in generated code,but in .md file,how to put the default value into the code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions