forked from loafle/openapi-generator-original
Set isModel property (#1275)
* Set isModel property * Replace tab characters
This commit is contained in:
parent
bb056ccf3d
commit
e06665f368
@ -25,7 +25,7 @@ import java.util.Map;
|
|||||||
public class CodegenParameter {
|
public class CodegenParameter {
|
||||||
public boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
public boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||||
isCookieParam, isBodyParam, hasMore, isContainer,
|
isCookieParam, isBodyParam, hasMore, isContainer,
|
||||||
secondaryParam, isCollectionFormatMulti, isPrimitiveType;
|
secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel;
|
||||||
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat,
|
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat,
|
||||||
collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName;
|
collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName;
|
||||||
|
|
||||||
@ -110,6 +110,7 @@ public class CodegenParameter {
|
|||||||
output.collectionFormat = this.collectionFormat;
|
output.collectionFormat = this.collectionFormat;
|
||||||
output.isCollectionFormatMulti = this.isCollectionFormatMulti;
|
output.isCollectionFormatMulti = this.isCollectionFormatMulti;
|
||||||
output.isPrimitiveType = this.isPrimitiveType;
|
output.isPrimitiveType = this.isPrimitiveType;
|
||||||
|
output.isModel = this.isModel;
|
||||||
output.description = this.description;
|
output.description = this.description;
|
||||||
output.unescapedDescription = this.unescapedDescription;
|
output.unescapedDescription = this.unescapedDescription;
|
||||||
output.baseType = this.baseType;
|
output.baseType = this.baseType;
|
||||||
@ -201,6 +202,8 @@ public class CodegenParameter {
|
|||||||
return false;
|
return false;
|
||||||
if (isPrimitiveType != that.isPrimitiveType)
|
if (isPrimitiveType != that.isPrimitiveType)
|
||||||
return false;
|
return false;
|
||||||
|
if (isModel != that.isModel)
|
||||||
|
return false;
|
||||||
if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null)
|
if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null)
|
||||||
return false;
|
return false;
|
||||||
if (paramName != null ? !paramName.equals(that.paramName) : that.paramName != null)
|
if (paramName != null ? !paramName.equals(that.paramName) : that.paramName != null)
|
||||||
@ -312,6 +315,7 @@ public class CodegenParameter {
|
|||||||
result = 31 * result + (secondaryParam ? 13:31);
|
result = 31 * result + (secondaryParam ? 13:31);
|
||||||
result = 31 * result + (isCollectionFormatMulti ? 13:31);
|
result = 31 * result + (isCollectionFormatMulti ? 13:31);
|
||||||
result = 31 * result + (isPrimitiveType ? 13:31);
|
result = 31 * result + (isPrimitiveType ? 13:31);
|
||||||
|
result = 31 * result + (isModel ? 13:31);
|
||||||
result = 31 * result + (baseName != null ? baseName.hashCode() : 0);
|
result = 31 * result + (baseName != null ? baseName.hashCode() : 0);
|
||||||
result = 31 * result + (paramName != null ? paramName.hashCode() : 0);
|
result = 31 * result + (paramName != null ? paramName.hashCode() : 0);
|
||||||
result = 31 * result + (dataType != null ? dataType.hashCode() : 0);
|
result = 31 * result + (dataType != null ? dataType.hashCode() : 0);
|
||||||
@ -378,6 +382,7 @@ public class CodegenParameter {
|
|||||||
", secondaryParam=" + secondaryParam +
|
", secondaryParam=" + secondaryParam +
|
||||||
", isCollectionFormatMulti=" + isCollectionFormatMulti +
|
", isCollectionFormatMulti=" + isCollectionFormatMulti +
|
||||||
", isPrimitiveType=" + isPrimitiveType +
|
", isPrimitiveType=" + isPrimitiveType +
|
||||||
|
", isModel=" + isModel +
|
||||||
", baseName='" + baseName + '\'' +
|
", baseName='" + baseName + '\'' +
|
||||||
", paramName='" + paramName + '\'' +
|
", paramName='" + paramName + '\'' +
|
||||||
", dataType='" + dataType + '\'' +
|
", dataType='" + dataType + '\'' +
|
||||||
|
@ -55,7 +55,7 @@ public class CodegenProperty implements Cloneable {
|
|||||||
public boolean exclusiveMaximum;
|
public boolean exclusiveMaximum;
|
||||||
public boolean hasMore, required, secondaryParam;
|
public boolean hasMore, required, secondaryParam;
|
||||||
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
|
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
|
||||||
public boolean isPrimitiveType, isContainer, isNotContainer;
|
public boolean isPrimitiveType, isModel, isContainer, isNotContainer;
|
||||||
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid;
|
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid;
|
||||||
public boolean isListContainer, isMapContainer;
|
public boolean isListContainer, isMapContainer;
|
||||||
public boolean isEnum;
|
public boolean isEnum;
|
||||||
@ -438,6 +438,7 @@ public class CodegenProperty implements Cloneable {
|
|||||||
result = prime * result + (isEnum ? 1231 : 1237);
|
result = prime * result + (isEnum ? 1231 : 1237);
|
||||||
result = prime * result + ((isNotContainer ? 13:31));
|
result = prime * result + ((isNotContainer ? 13:31));
|
||||||
result = prime * result + ((isPrimitiveType ? 13:31));
|
result = prime * result + ((isPrimitiveType ? 13:31));
|
||||||
|
result = prime * result + ((isModel ? 13:31));
|
||||||
result = prime * result + ((isReadOnly ? 13:31));
|
result = prime * result + ((isReadOnly ? 13:31));
|
||||||
result = prime * result + ((isWriteOnly ? 13:31));
|
result = prime * result + ((isWriteOnly ? 13:31));
|
||||||
result = prime * result + ((isNullable ? 13:31));
|
result = prime * result + ((isNullable ? 13:31));
|
||||||
@ -579,6 +580,9 @@ public class CodegenProperty implements Cloneable {
|
|||||||
if (this.isPrimitiveType != other.isPrimitiveType) {
|
if (this.isPrimitiveType != other.isPrimitiveType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.isModel != other.isModel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (this.isContainer != other.isContainer) {
|
if (this.isContainer != other.isContainer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -759,6 +763,7 @@ public class CodegenProperty implements Cloneable {
|
|||||||
", secondaryParam=" + secondaryParam +
|
", secondaryParam=" + secondaryParam +
|
||||||
", hasMoreNonReadOnly=" + hasMoreNonReadOnly +
|
", hasMoreNonReadOnly=" + hasMoreNonReadOnly +
|
||||||
", isPrimitiveType=" + isPrimitiveType +
|
", isPrimitiveType=" + isPrimitiveType +
|
||||||
|
", isModel=" + isModel +
|
||||||
", isContainer=" + isContainer +
|
", isContainer=" + isContainer +
|
||||||
", isNotContainer=" + isNotContainer +
|
", isNotContainer=" + isNotContainer +
|
||||||
", isString=" + isString +
|
", isString=" + isString +
|
||||||
|
@ -2175,6 +2175,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
} else {
|
} else {
|
||||||
property.complexType = property.baseType;
|
property.complexType = property.baseType;
|
||||||
|
property.isModel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4515,6 +4516,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
schema.setName(name);
|
schema.setName(name);
|
||||||
codegenModel = fromModel(name, schema, schemas);
|
codegenModel = fromModel(name, schema, schemas);
|
||||||
}
|
}
|
||||||
|
if (codegenModel != null) {
|
||||||
|
codegenParameter.isModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (codegenModel != null && !codegenModel.emptyVars) {
|
if (codegenModel != null && !codegenModel.emptyVars) {
|
||||||
if (StringUtils.isEmpty(bodyParameterName)) {
|
if (StringUtils.isEmpty(bodyParameterName)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user