mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 00:21:19 +00:00
A parameter's default value is not flowing from the swagger definition to the actual API implementation. This change makes the property from the swagger def json available to the templates.
This commit is contained in:
@@ -3,7 +3,7 @@ package com.wordnik.swagger.codegen;
|
||||
public class CodegenParameter {
|
||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam;
|
||||
public String baseName, paramName, dataType, collectionFormat, description, baseType;
|
||||
public String baseName, paramName, dataType, collectionFormat, description, baseType, defaultValue;
|
||||
public String jsonSchema;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,8 @@ public class CodegenParameter {
|
||||
output.isBodyParam = this.isBodyParam;
|
||||
output.required = this.required;
|
||||
output.jsonSchema = this.jsonSchema;
|
||||
output.defaultValue = this.defaultValue;
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,6 +904,10 @@ public class DefaultCodegen {
|
||||
p.required = param.getRequired();
|
||||
p.jsonSchema = Json.pretty(param);
|
||||
|
||||
if(param instanceof QueryParameter) {
|
||||
p.defaultValue = ((QueryParameter)param).getDefaultValue();
|
||||
}
|
||||
|
||||
if(param instanceof SerializableParameter) {
|
||||
SerializableParameter qp = (SerializableParameter) param;
|
||||
Property property = null;
|
||||
|
||||
Reference in New Issue
Block a user