forked from loafle/openapi-generator-original
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:
parent
0248d6fd9f
commit
33138c139f
@ -3,7 +3,7 @@ package com.wordnik.swagger.codegen;
|
|||||||
public class CodegenParameter {
|
public class CodegenParameter {
|
||||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||||
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam;
|
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;
|
public String jsonSchema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +34,8 @@ public class CodegenParameter {
|
|||||||
output.isBodyParam = this.isBodyParam;
|
output.isBodyParam = this.isBodyParam;
|
||||||
output.required = this.required;
|
output.required = this.required;
|
||||||
output.jsonSchema = this.jsonSchema;
|
output.jsonSchema = this.jsonSchema;
|
||||||
|
output.defaultValue = this.defaultValue;
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -904,6 +904,10 @@ public class DefaultCodegen {
|
|||||||
p.required = param.getRequired();
|
p.required = param.getRequired();
|
||||||
p.jsonSchema = Json.pretty(param);
|
p.jsonSchema = Json.pretty(param);
|
||||||
|
|
||||||
|
if(param instanceof QueryParameter) {
|
||||||
|
p.defaultValue = ((QueryParameter)param).getDefaultValue();
|
||||||
|
}
|
||||||
|
|
||||||
if(param instanceof SerializableParameter) {
|
if(param instanceof SerializableParameter) {
|
||||||
SerializableParameter qp = (SerializableParameter) param;
|
SerializableParameter qp = (SerializableParameter) param;
|
||||||
Property property = null;
|
Property property = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user