Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DefaultCodegenConfig] Handle default parameter values #565

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Handle default parameter values
  • Loading branch information
michaeldavis-wf committed Dec 19, 2019
commit a06fe5ed945686e77760c2efc7782d0a383c1984
Original file line number Diff line number Diff line change
Expand Up @@ -2376,6 +2376,19 @@ public CodegenParameter fromParameter(Parameter parameter, Set<String> imports)
LOGGER.info("working on Parameter " + parameter.getName());
}

// move the defaultValue for headers and query params
if (parameter instanceof QueryParameter) {
QueryParameter qp = (QueryParameter) parameter;
if(qp.getSchema().getDefault() != null) {
codegenParameter.defaultValue = qp.getSchema().getDefault().toString();
}
} else if (parameter instanceof HeaderParameter) {
HeaderParameter hp = (HeaderParameter) parameter;
if(hp.getSchema().getDefault() != null) {
codegenParameter.defaultValue = hp.getSchema().getDefault().toString();
}
}

if (parameter.getExtensions() != null && !parameter.getExtensions().isEmpty()) {
codegenParameter.vendorExtensions.putAll(parameter.getExtensions());
}
Expand Down