forked from loafle/openapi-generator-original
[General] Better code format (#11612)
* better code format in java tests * better code format in java client codegen * better code format in java model tests * better code format in abstract java codegen * better code format in codegen parameter, property * better code format in codegen response * better code format in codegen model * better code format in default generator * better code format in default codegen * update codegen model
This commit is contained in:
parent
52e3265c34
commit
878f6e5709
@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -575,7 +576,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsModel() { return isModel; }
|
public boolean getIsModel() {
|
||||||
|
return isModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsModel(boolean isModel) {
|
public void setIsModel(boolean isModel) {
|
||||||
@ -583,7 +586,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDate() { return isDate; }
|
public boolean getIsDate() {
|
||||||
|
return isDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDate(boolean isDate) {
|
public void setIsDate(boolean isDate) {
|
||||||
@ -591,7 +596,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDateTime() { return isDateTime; }
|
public boolean getIsDateTime() {
|
||||||
|
return isDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDateTime(boolean isDateTime) {
|
public void setIsDateTime(boolean isDateTime) {
|
||||||
@ -599,7 +606,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsMap() { return isMap; }
|
public boolean getIsMap() {
|
||||||
|
return isMap;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsMap(boolean isMap) {
|
public void setIsMap(boolean isMap) {
|
||||||
@ -607,7 +616,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsArray() { return isArray; }
|
public boolean getIsArray() {
|
||||||
|
return isArray;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsArray(boolean isArray) {
|
public void setIsArray(boolean isArray) {
|
||||||
@ -615,7 +626,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsShort() { return isShort; }
|
public boolean getIsShort() {
|
||||||
|
return isShort;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsShort(boolean isShort) {
|
public void setIsShort(boolean isShort) {
|
||||||
@ -623,15 +636,19 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsBoolean() { return isBoolean; }
|
public boolean getIsBoolean() {
|
||||||
|
return isBoolean;
|
||||||
@Override
|
|
||||||
public void setIsBoolean(boolean isBoolean) {
|
|
||||||
this.isBoolean= isBoolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
public void setIsBoolean(boolean isBoolean) {
|
||||||
|
this.isBoolean = isBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getIsUnboundedInteger() {
|
||||||
|
return isUnboundedInteger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||||
@ -639,7 +656,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsPrimitiveType() { return isPrimitiveType; }
|
public boolean getIsPrimitiveType() {
|
||||||
|
return isPrimitiveType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
||||||
@ -647,7 +666,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
|
public CodegenProperty getAdditionalProperties() {
|
||||||
|
return additionalProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
||||||
@ -655,10 +676,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasValidation() { return hasValidation; }
|
public boolean getHasValidation() {
|
||||||
|
return hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; }
|
public void setHasValidation(boolean hasValidation) {
|
||||||
|
this.hasValidation = hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
public List<CodegenProperty> getReadOnlyVars() {
|
public List<CodegenProperty> getReadOnlyVars() {
|
||||||
return readOnlyVars;
|
return readOnlyVars;
|
||||||
@ -785,7 +810,11 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasDiscriminatorWithNonEmptyMapping() { return hasDiscriminatorWithNonEmptyMapping; };
|
public boolean getHasDiscriminatorWithNonEmptyMapping() {
|
||||||
|
return hasDiscriminatorWithNonEmptyMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||||
@ -793,7 +822,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsString() { return isString; }
|
public boolean getIsString() {
|
||||||
|
return isString;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsString(boolean isString) {
|
public void setIsString(boolean isString) {
|
||||||
@ -801,7 +832,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsNumber() { return isNumber; }
|
public boolean getIsNumber() {
|
||||||
|
return isNumber;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsNumber(boolean isNumber) {
|
public void setIsNumber(boolean isNumber) {
|
||||||
@ -809,7 +842,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsAnyType() { return isAnyType; }
|
public boolean getIsAnyType() {
|
||||||
|
return isAnyType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsAnyType(boolean isAnyType) {
|
public void setIsAnyType(boolean isAnyType) {
|
||||||
@ -827,10 +862,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
public boolean getHasMultipleTypes() {
|
||||||
|
return hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
public void setHasMultipleTypes(boolean hasMultipleTypes) {
|
||||||
|
this.hasMultipleTypes = hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
@ -1043,7 +1082,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDiscriminatorMappedModelsImports(){
|
public void addDiscriminatorMappedModelsImports() {
|
||||||
if (discriminator == null || discriminator.getMappedModels() == null) {
|
if (discriminator == null || discriminator.getMappedModels() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1065,6 +1104,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
public boolean getHasItems() {
|
public boolean getHasItems() {
|
||||||
return this.items != null;
|
return this.items != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove duplicated properties in all variable list
|
* Remove duplicated properties in all variable list
|
||||||
*/
|
*/
|
||||||
|
@ -560,7 +560,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsModel() { return isModel; }
|
public boolean getIsModel() {
|
||||||
|
return isModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsModel(boolean isModel) {
|
public void setIsModel(boolean isModel) {
|
||||||
@ -568,7 +570,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDate() { return isDate; }
|
public boolean getIsDate() {
|
||||||
|
return isDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDate(boolean isDate) {
|
public void setIsDate(boolean isDate) {
|
||||||
@ -576,7 +580,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDateTime() { return isDateTime; }
|
public boolean getIsDateTime() {
|
||||||
|
return isDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDateTime(boolean isDateTime) {
|
public void setIsDateTime(boolean isDateTime) {
|
||||||
@ -584,7 +590,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsMap() { return isMap; }
|
public boolean getIsMap() {
|
||||||
|
return isMap;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsMap(boolean isMap) {
|
public void setIsMap(boolean isMap) {
|
||||||
@ -592,7 +600,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsArray() { return isArray; }
|
public boolean getIsArray() {
|
||||||
|
return isArray;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsArray(boolean isArray) {
|
public void setIsArray(boolean isArray) {
|
||||||
@ -600,7 +610,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsShort() { return isShort; }
|
public boolean getIsShort() {
|
||||||
|
return isShort;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsShort(boolean isShort) {
|
public void setIsShort(boolean isShort) {
|
||||||
@ -608,7 +620,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsBoolean() { return isBoolean; }
|
public boolean getIsBoolean() {
|
||||||
|
return isBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsBoolean(boolean isBoolean) {
|
public void setIsBoolean(boolean isBoolean) {
|
||||||
@ -616,7 +630,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
public boolean getIsUnboundedInteger() {
|
||||||
|
return isUnboundedInteger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||||
@ -624,7 +640,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsPrimitiveType() { return isPrimitiveType; }
|
public boolean getIsPrimitiveType() {
|
||||||
|
return isPrimitiveType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
||||||
@ -632,7 +650,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
|
public CodegenProperty getAdditionalProperties() {
|
||||||
|
return additionalProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
||||||
@ -670,10 +690,14 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasValidation() { return hasValidation; }
|
public boolean getHasValidation() {
|
||||||
|
return hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; }
|
public void setHasValidation(boolean hasValidation) {
|
||||||
|
this.hasValidation = hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getAdditionalPropertiesIsAnyType() {
|
public boolean getAdditionalPropertiesIsAnyType() {
|
||||||
@ -706,7 +730,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasDiscriminatorWithNonEmptyMapping() { return hasDiscriminatorWithNonEmptyMapping; };
|
public boolean getHasDiscriminatorWithNonEmptyMapping() {
|
||||||
|
return hasDiscriminatorWithNonEmptyMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||||
@ -714,7 +742,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsString() { return isString; }
|
public boolean getIsString() {
|
||||||
|
return isString;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsString(boolean isString) {
|
public void setIsString(boolean isString) {
|
||||||
@ -722,7 +752,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsNumber() { return isNumber; }
|
public boolean getIsNumber() {
|
||||||
|
return isNumber;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsNumber(boolean isNumber) {
|
public void setIsNumber(boolean isNumber) {
|
||||||
@ -730,7 +762,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsAnyType() { return isAnyType; }
|
public boolean getIsAnyType() {
|
||||||
|
return isAnyType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsAnyType(boolean isAnyType) {
|
public void setIsAnyType(boolean isAnyType) {
|
||||||
@ -748,14 +782,22 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
public boolean getHasMultipleTypes() {
|
||||||
|
return hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
public void setHasMultipleTypes(boolean hasMultipleTypes) {
|
||||||
|
this.hasMultipleTypes = hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public CodegenProperty getSchema() {return schema; }
|
public CodegenProperty getSchema() {
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSchema(CodegenProperty schema) { this.schema = schema; }
|
public void setSchema(CodegenProperty schema) {
|
||||||
|
this.schema = schema;
|
||||||
|
}
|
||||||
|
|
||||||
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
||||||
return content;
|
return content;
|
||||||
|
@ -465,7 +465,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
|
public CodegenProperty getAdditionalProperties() {
|
||||||
|
return additionalProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
||||||
@ -473,7 +475,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsModel() { return isModel; }
|
public boolean getIsModel() {
|
||||||
|
return isModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsModel(boolean isModel) {
|
public void setIsModel(boolean isModel) {
|
||||||
@ -481,7 +485,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDate() { return isDate; }
|
public boolean getIsDate() {
|
||||||
|
return isDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDate(boolean isDate) {
|
public void setIsDate(boolean isDate) {
|
||||||
@ -489,7 +495,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDateTime() { return isDateTime; }
|
public boolean getIsDateTime() {
|
||||||
|
return isDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDateTime(boolean isDateTime) {
|
public void setIsDateTime(boolean isDateTime) {
|
||||||
@ -497,7 +505,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsMap() { return isMap; }
|
public boolean getIsMap() {
|
||||||
|
return isMap;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsMap(boolean isMap) {
|
public void setIsMap(boolean isMap) {
|
||||||
@ -505,7 +515,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsArray() { return isArray; }
|
public boolean getIsArray() {
|
||||||
|
return isArray;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsArray(boolean isArray) {
|
public void setIsArray(boolean isArray) {
|
||||||
@ -513,7 +525,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsShort() { return isShort; }
|
public boolean getIsShort() {
|
||||||
|
return isShort;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsShort(boolean isShort) {
|
public void setIsShort(boolean isShort) {
|
||||||
@ -521,7 +535,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsBoolean() { return isBoolean; }
|
public boolean getIsBoolean() {
|
||||||
|
return isBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsBoolean(boolean isBoolean) {
|
public void setIsBoolean(boolean isBoolean) {
|
||||||
@ -529,7 +545,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
public boolean getIsUnboundedInteger() {
|
||||||
|
return isUnboundedInteger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||||
@ -537,7 +555,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsPrimitiveType() { return isPrimitiveType; }
|
public boolean getIsPrimitiveType() {
|
||||||
|
return isPrimitiveType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
||||||
@ -743,10 +763,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasValidation() { return hasValidation; }
|
public boolean getHasValidation() {
|
||||||
|
return hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; }
|
public void setHasValidation(boolean hasValidation) {
|
||||||
|
this.hasValidation = hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getAdditionalPropertiesIsAnyType() {
|
public boolean getAdditionalPropertiesIsAnyType() {
|
||||||
@ -779,7 +803,11 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasDiscriminatorWithNonEmptyMapping() { return hasDiscriminatorWithNonEmptyMapping; };
|
public boolean getHasDiscriminatorWithNonEmptyMapping() {
|
||||||
|
return hasDiscriminatorWithNonEmptyMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||||
@ -791,7 +819,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsString() { return isString; }
|
public boolean getIsString() {
|
||||||
|
return isString;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsString(boolean isString) {
|
public void setIsString(boolean isString) {
|
||||||
@ -799,7 +829,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsNumber() { return isNumber; }
|
public boolean getIsNumber() {
|
||||||
|
return isNumber;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsNumber(boolean isNumber) {
|
public void setIsNumber(boolean isNumber) {
|
||||||
@ -807,7 +839,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsAnyType() { return isAnyType; }
|
public boolean getIsAnyType() {
|
||||||
|
return isAnyType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsAnyType(boolean isAnyType) {
|
public void setIsAnyType(boolean isAnyType) {
|
||||||
@ -815,10 +849,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
public boolean getHasMultipleTypes() {
|
||||||
|
return hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
public void setHasMultipleTypes(boolean hasMultipleTypes) {
|
||||||
|
this.hasMultipleTypes = hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@ -972,7 +1010,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping &&
|
hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping &&
|
||||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||||
getHasVars() == that.getHasVars() &&
|
getHasVars() == that.getHasVars() &&
|
||||||
getHasRequired() ==that.getHasRequired() &&
|
getHasRequired() == that.getHasRequired() &&
|
||||||
Objects.equals(composedSchemas, that.composedSchemas) &&
|
Objects.equals(composedSchemas, that.composedSchemas) &&
|
||||||
Objects.equals(openApiType, that.openApiType) &&
|
Objects.equals(openApiType, that.openApiType) &&
|
||||||
Objects.equals(baseName, that.baseName) &&
|
Objects.equals(baseName, that.baseName) &&
|
||||||
|
@ -337,10 +337,14 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsModel() { return isModel; }
|
public boolean getIsModel() {
|
||||||
|
return isModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsArray() { return isArray; }
|
public boolean getIsArray() {
|
||||||
|
return isArray;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsArray(boolean isArray) {
|
public void setIsArray(boolean isArray) {
|
||||||
@ -348,7 +352,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsShort() { return isShort; }
|
public boolean getIsShort() {
|
||||||
|
return isShort;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsShort(boolean isShort) {
|
public void setIsShort(boolean isShort) {
|
||||||
@ -356,7 +362,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsBoolean() { return isBoolean; }
|
public boolean getIsBoolean() {
|
||||||
|
return isBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsBoolean(boolean isBoolean) {
|
public void setIsBoolean(boolean isBoolean) {
|
||||||
@ -364,7 +372,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
public boolean getIsUnboundedInteger() {
|
||||||
|
return isUnboundedInteger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||||
@ -372,7 +382,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsPrimitiveType() { return primitiveType; }
|
public boolean getIsPrimitiveType() {
|
||||||
|
return primitiveType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
public void setIsPrimitiveType(boolean isPrimitiveType) {
|
||||||
@ -385,7 +397,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDate() { return isDate; }
|
public boolean getIsDate() {
|
||||||
|
return isDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDate(boolean isDate) {
|
public void setIsDate(boolean isDate) {
|
||||||
@ -393,7 +407,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsDateTime() { return isDateTime; }
|
public boolean getIsDateTime() {
|
||||||
|
return isDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsDateTime(boolean isDateTime) {
|
public void setIsDateTime(boolean isDateTime) {
|
||||||
@ -401,7 +417,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsMap() { return isMap; }
|
public boolean getIsMap() {
|
||||||
|
return isMap;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsMap(boolean isMap) {
|
public void setIsMap(boolean isMap) {
|
||||||
@ -409,7 +427,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
|
public CodegenProperty getAdditionalProperties() {
|
||||||
|
return additionalProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
public void setAdditionalProperties(CodegenProperty additionalProperties) {
|
||||||
@ -550,10 +570,14 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasValidation() { return hasValidation; }
|
public boolean getHasValidation() {
|
||||||
|
return hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; }
|
public void setHasValidation(boolean hasValidation) {
|
||||||
|
this.hasValidation = hasValidation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getAdditionalPropertiesIsAnyType() {
|
public boolean getAdditionalPropertiesIsAnyType() {
|
||||||
@ -576,7 +600,11 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasDiscriminatorWithNonEmptyMapping() { return hasDiscriminatorWithNonEmptyMapping; };
|
public boolean getHasDiscriminatorWithNonEmptyMapping() {
|
||||||
|
return hasDiscriminatorWithNonEmptyMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||||
@ -584,7 +612,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsString() { return isString; }
|
public boolean getIsString() {
|
||||||
|
return isString;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsString(boolean isString) {
|
public void setIsString(boolean isString) {
|
||||||
@ -592,7 +622,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsNumber() { return isNumber; }
|
public boolean getIsNumber() {
|
||||||
|
return isNumber;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsNumber(boolean isNumber) {
|
public void setIsNumber(boolean isNumber) {
|
||||||
@ -600,7 +632,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsAnyType() { return isAnyType; }
|
public boolean getIsAnyType() {
|
||||||
|
return isAnyType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsAnyType(boolean isAnyType) {
|
public void setIsAnyType(boolean isAnyType) {
|
||||||
@ -618,10 +652,14 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
public boolean getHasMultipleTypes() {
|
||||||
|
return hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
public void setHasMultipleTypes(boolean hasMultipleTypes) {
|
||||||
|
this.hasMultipleTypes = hasMultipleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBaseType() {
|
public String getBaseType() {
|
||||||
|
@ -1536,12 +1536,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
/**
|
/**
|
||||||
* Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input.
|
* Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input.
|
||||||
* In case of union types this method has a key for each separate model and import.
|
* In case of union types this method has a key for each separate model and import.
|
||||||
|
*
|
||||||
* @param name the name of the "Model"
|
* @param name the name of the "Model"
|
||||||
* @return Map of fully-qualified models.
|
* @return Map of fully-qualified models.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String,String> toModelImportMap(String name){
|
public Map<String, String> toModelImportMap(String name) {
|
||||||
return Collections.singletonMap(this.toModelImport(name),name);
|
return Collections.singletonMap(this.toModelImport(name), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1958,7 +1959,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the default value of the property
|
* Return the default value of the property
|
||||||
*
|
* <p>
|
||||||
* Return null if you do NOT want a default value.
|
* Return null if you do NOT want a default value.
|
||||||
* Any non-null value will cause {{#defaultValue} check to pass.
|
* Any non-null value will cause {{#defaultValue} check to pass.
|
||||||
*
|
*
|
||||||
@ -1976,7 +1977,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the default value of the parameter
|
* Return the default value of the parameter
|
||||||
*
|
* <p>
|
||||||
* Return null if you do NOT want a default value.
|
* Return null if you do NOT want a default value.
|
||||||
* Any non-null value will cause {{#defaultValue} check to pass.
|
* Any non-null value will cause {{#defaultValue} check to pass.
|
||||||
*
|
*
|
||||||
@ -2401,6 +2402,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.schema = s;
|
this.schema = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private Schema schema;
|
private Schema schema;
|
||||||
|
|
||||||
@ -2791,7 +2793,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.requiredVars != null && m.requiredVars.size() > 0){
|
if (m.requiredVars != null && m.requiredVars.size() > 0) {
|
||||||
m.setHasRequired(true);
|
m.setHasRequired(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2824,7 +2826,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setAddProps(Schema schema, IJsonSchemaValidationProperties property){
|
protected void setAddProps(Schema schema, IJsonSchemaValidationProperties property) {
|
||||||
if (schema.equals(new Schema())) {
|
if (schema.equals(new Schema())) {
|
||||||
// if we are trying to set additionalProperties on an empty schema stop recursing
|
// if we are trying to set additionalProperties on an empty schema stop recursing
|
||||||
return;
|
return;
|
||||||
@ -3216,7 +3218,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
for (MappedModel otherDescendant : otherDescendants) {
|
for (MappedModel otherDescendant : otherDescendants) {
|
||||||
// add only if the mapping names are not the same
|
// add only if the mapping names are not the same
|
||||||
boolean matched = false;
|
boolean matched = false;
|
||||||
for (MappedModel uniqueDescendant: uniqueDescendants) {
|
for (MappedModel uniqueDescendant : uniqueDescendants) {
|
||||||
if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())) {
|
if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())) {
|
||||||
matched = true;
|
matched = true;
|
||||||
break;
|
break;
|
||||||
@ -3404,7 +3406,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert OAS Property object to Codegen Property object.
|
* Convert OAS Property object to Codegen Property object.
|
||||||
*
|
* <p>
|
||||||
* The return value is cached. An internal cache is looked up to determine
|
* The return value is cached. An internal cache is looked up to determine
|
||||||
* if the CodegenProperty return value has already been instantiated for
|
* if the CodegenProperty return value has already been instantiated for
|
||||||
* the (String name, Schema p) arguments.
|
* the (String name, Schema p) arguments.
|
||||||
@ -3635,7 +3637,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
*/
|
*/
|
||||||
protected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty) {
|
protected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty) {
|
||||||
if (innerProperty == null) {
|
if (innerProperty == null) {
|
||||||
if(LOGGER.isWarnEnabled()) {
|
if (LOGGER.isWarnEnabled()) {
|
||||||
LOGGER.warn("skipping invalid array property {}", Json.pretty(property));
|
LOGGER.warn("skipping invalid array property {}", Json.pretty(property));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -3670,7 +3672,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
*/
|
*/
|
||||||
protected void updatePropertyForMap(CodegenProperty property, CodegenProperty innerProperty) {
|
protected void updatePropertyForMap(CodegenProperty property, CodegenProperty innerProperty) {
|
||||||
if (innerProperty == null) {
|
if (innerProperty == null) {
|
||||||
if(LOGGER.isWarnEnabled()) {
|
if (LOGGER.isWarnEnabled()) {
|
||||||
LOGGER.warn("skipping invalid map property {}", Json.pretty(property));
|
LOGGER.warn("skipping invalid map property {}", Json.pretty(property));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -3994,7 +3996,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Map<String, Header> headers = response.getHeaders();
|
Map<String, Header> headers = response.getHeaders();
|
||||||
if (headers != null) {
|
if (headers != null) {
|
||||||
List<CodegenParameter> responseHeaders = new ArrayList<>();
|
List<CodegenParameter> responseHeaders = new ArrayList<>();
|
||||||
for (Entry<String, Header> entry: headers.entrySet()) {
|
for (Entry<String, Header> entry : headers.entrySet()) {
|
||||||
String headerName = entry.getKey();
|
String headerName = entry.getKey();
|
||||||
Header header = entry.getValue();
|
Header header = entry.getValue();
|
||||||
CodegenParameter responseHeader = heeaderToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code));
|
CodegenParameter responseHeader = heeaderToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code));
|
||||||
@ -4386,7 +4388,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
addVarsRequiredVarsAdditionalProps(responseSchema, r);
|
addVarsRequiredVarsAdditionalProps(responseSchema, r);
|
||||||
} else if (ModelUtils.isAnyType(responseSchema)) {
|
} else if (ModelUtils.isAnyType(responseSchema)) {
|
||||||
addVarsRequiredVarsAdditionalProps(responseSchema, r);
|
addVarsRequiredVarsAdditionalProps(responseSchema, r);
|
||||||
} else if (!ModelUtils.isBooleanSchema(responseSchema)){
|
} else if (!ModelUtils.isBooleanSchema(responseSchema)) {
|
||||||
// referenced schemas
|
// referenced schemas
|
||||||
LOGGER.debug("Property type is not primitive: {}", cp.dataType);
|
LOGGER.debug("Property type is not primitive: {}", cp.dataType);
|
||||||
}
|
}
|
||||||
@ -4498,7 +4500,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateParameterForString(CodegenParameter codegenParameter, Schema parameterSchema){
|
protected void updateParameterForString(CodegenParameter codegenParameter, Schema parameterSchema) {
|
||||||
if (ModelUtils.isEmailSchema(parameterSchema)) {
|
if (ModelUtils.isEmailSchema(parameterSchema)) {
|
||||||
codegenParameter.isEmail = true;
|
codegenParameter.isEmail = true;
|
||||||
} else if (ModelUtils.isUUIDSchema(parameterSchema)) {
|
} else if (ModelUtils.isUUIDSchema(parameterSchema)) {
|
||||||
@ -4752,7 +4754,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.items = fromProperty(codegenParameter.paramName, schema);
|
codegenParameter.items = fromProperty(codegenParameter.paramName, schema);
|
||||||
// TODO Check why schema is actually null for a schema of type object defined inline
|
// TODO Check why schema is actually null for a schema of type object defined inline
|
||||||
// https://swagger.io/docs/specification/serialization/
|
// https://swagger.io/docs/specification/serialization/
|
||||||
if(schema != null) {
|
if (schema != null) {
|
||||||
Map<String, Schema<?>> properties = schema.getProperties();
|
Map<String, Schema<?>> properties = schema.getProperties();
|
||||||
codegenParameter.items.vars =
|
codegenParameter.items.vars =
|
||||||
properties.entrySet().stream()
|
properties.entrySet().stream()
|
||||||
@ -4761,8 +4763,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
property.baseName = codegenParameter.baseName + "[" + entry.getKey() + "]";
|
property.baseName = codegenParameter.baseName + "[" + entry.getKey() + "]";
|
||||||
return property;
|
return property;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"No object schema found for deepObject parameter{} deepObject won't have specific properties",
|
"No object schema found for deepObject parameter{} deepObject won't have specific properties",
|
||||||
codegenParameter);
|
codegenParameter);
|
||||||
@ -5082,7 +5083,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* of the 'additionalProperties' keyword. Some language generator use class inheritance
|
* of the 'additionalProperties' keyword. Some language generator use class inheritance
|
||||||
* to implement additional properties. For example, in Java the generated model class
|
* to implement additional properties. For example, in Java the generated model class
|
||||||
* has 'extends HashMap' to represent the additional properties.
|
* has 'extends HashMap' to represent the additional properties.
|
||||||
*
|
* <p>
|
||||||
* TODO: it's not a good idea to use single class inheritance to implement
|
* TODO: it's not a good idea to use single class inheritance to implement
|
||||||
* additionalProperties. That may work for non-composed schemas, but that does not
|
* additionalProperties. That may work for non-composed schemas, but that does not
|
||||||
* work for composed 'allOf' schemas. For example, in Java, if additionalProperties
|
* work for composed 'allOf' schemas. For example, in Java, if additionalProperties
|
||||||
@ -5505,6 +5506,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* check if current active library equals to passed
|
* check if current active library equals to passed
|
||||||
|
*
|
||||||
* @param library - library to be compared with
|
* @param library - library to be compared with
|
||||||
* @return {@code true} if passed library is active, {@code false} otherwise
|
* @return {@code true} if passed library is active, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
@ -6718,18 +6720,18 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
LinkedHashMap<String, CodegenMediaType> cmtContent = new LinkedHashMap<>();
|
LinkedHashMap<String, CodegenMediaType> cmtContent = new LinkedHashMap<>();
|
||||||
for (Entry<String, MediaType> contentEntry: content.entrySet()) {
|
for (Entry<String, MediaType> contentEntry : content.entrySet()) {
|
||||||
MediaType mt = contentEntry.getValue();
|
MediaType mt = contentEntry.getValue();
|
||||||
LinkedHashMap<String, CodegenEncoding> ceMap = null;
|
LinkedHashMap<String, CodegenEncoding> ceMap = null;
|
||||||
if (mt.getEncoding() != null ) {
|
if (mt.getEncoding() != null) {
|
||||||
ceMap = new LinkedHashMap<>();
|
ceMap = new LinkedHashMap<>();
|
||||||
Map<String, Encoding> encMap = mt.getEncoding();
|
Map<String, Encoding> encMap = mt.getEncoding();
|
||||||
for (Entry<String, Encoding> encodingEntry: encMap.entrySet()) {
|
for (Entry<String, Encoding> encodingEntry : encMap.entrySet()) {
|
||||||
Encoding enc = encodingEntry.getValue();
|
Encoding enc = encodingEntry.getValue();
|
||||||
List<CodegenParameter> headers = new ArrayList<>();
|
List<CodegenParameter> headers = new ArrayList<>();
|
||||||
if (enc.getHeaders() != null) {
|
if (enc.getHeaders() != null) {
|
||||||
Map<String, Header> encHeaders = enc.getHeaders();
|
Map<String, Header> encHeaders = enc.getHeaders();
|
||||||
for (Entry<String, Header> headerEntry: encHeaders.entrySet()) {
|
for (Entry<String, Header> headerEntry : encHeaders.entrySet()) {
|
||||||
String headerName = headerEntry.getKey();
|
String headerName = headerEntry.getKey();
|
||||||
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
||||||
CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix);
|
CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix);
|
||||||
@ -6852,7 +6854,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return codegenParameter;
|
return codegenParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){
|
protected void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property) {
|
||||||
setAddProps(schema, property);
|
setAddProps(schema, property);
|
||||||
if (!"object".equals(schema.getType())) {
|
if (!"object".equals(schema.getType())) {
|
||||||
return;
|
return;
|
||||||
@ -6994,7 +6996,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenServerVariable.value = value;
|
codegenServerVariable.value = value;
|
||||||
|
|
||||||
if (enums != null && !enums.isEmpty() && !enums.contains(value)) {
|
if (enums != null && !enums.isEmpty() && !enums.contains(value)) {
|
||||||
if(LOGGER.isWarnEnabled()) { // prevents calculating StringUtils.join when debug isn't enabled
|
if (LOGGER.isWarnEnabled()) { // prevents calculating StringUtils.join when debug isn't enabled
|
||||||
LOGGER.warn("Variable override of '{}' is not listed in the enum of allowed values ({}).", value, StringUtils.join(enums, ","));
|
LOGGER.warn("Variable override of '{}' is not listed in the enum of allowed values ({}).", value, StringUtils.join(enums, ","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7303,7 +7305,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the additionalProperties Schema for the specified input schema.
|
* Returns the additionalProperties Schema for the specified input schema.
|
||||||
*
|
* <p>
|
||||||
* The additionalProperties keyword is used to control the handling of additional, undeclared
|
* The additionalProperties keyword is used to control the handling of additional, undeclared
|
||||||
* properties, that is, properties whose names are not listed in the properties keyword.
|
* properties, that is, properties whose names are not listed in the properties keyword.
|
||||||
* The additionalProperties keyword may be either a boolean or an object.
|
* The additionalProperties keyword may be either a boolean or an object.
|
||||||
@ -7376,7 +7378,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
List<CodegenProperty> xOf = new ArrayList<>();
|
List<CodegenProperty> xOf = new ArrayList<>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Schema xOfSchema: xOfCollection) {
|
for (Schema xOfSchema : xOfCollection) {
|
||||||
CodegenProperty cp = fromProperty(collectionName + "_" + i, xOfSchema);
|
CodegenProperty cp = fromProperty(collectionName + "_" + i, xOfSchema);
|
||||||
xOf.add(cp);
|
xOf.add(cp);
|
||||||
i += 1;
|
i += 1;
|
||||||
@ -7390,8 +7392,14 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.JAVA; }
|
public GeneratorLanguage generatorLanguage() {
|
||||||
|
return GeneratorLanguage.JAVA;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generatorLanguageVersion() { return null; };
|
public String generatorLanguageVersion() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
this.userDefinedTemplates = Collections.unmodifiableList(userFiles);
|
this.userDefinedTemplates = Collections.unmodifiableList(userFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(this.config.isEnableMinimalUpdate(),this.config.isSkipOverwrite());
|
TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(this.config.isEnableMinimalUpdate(), this.config.isSkipOverwrite());
|
||||||
|
|
||||||
if (this.dryRun) {
|
if (this.dryRun) {
|
||||||
this.templateProcessor = new DryRunTemplateManager(templateManagerOptions);
|
this.templateProcessor = new DryRunTemplateManager(templateManagerOptions);
|
||||||
@ -459,7 +459,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
// this use case arises when using interface schemas
|
// this use case arises when using interface schemas
|
||||||
// generators may choose to make models for use case 2 + 3
|
// generators may choose to make models for use case 2 + 3
|
||||||
Schema refSchema = new Schema();
|
Schema refSchema = new Schema();
|
||||||
refSchema.set$ref("#/components/schemas/"+name);
|
refSchema.set$ref("#/components/schemas/" + name);
|
||||||
Schema unaliasedSchema = config.unaliasSchema(refSchema, config.importMapping());
|
Schema unaliasedSchema = config.unaliasSchema(refSchema, config.importMapping());
|
||||||
if (unaliasedSchema.get$ref() == null) {
|
if (unaliasedSchema.get$ref() == null) {
|
||||||
LOGGER.info("Model {} not generated since it's a free-form object", name);
|
LOGGER.info("Model {} not generated since it's a free-form object", name);
|
||||||
@ -692,7 +692,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
}
|
}
|
||||||
File of = new File(outputFolder);
|
File of = new File(outputFolder);
|
||||||
if (!of.isDirectory()) {
|
if (!of.isDirectory()) {
|
||||||
if(!dryRun && !of.mkdirs()) {
|
if (!dryRun && !of.mkdirs()) {
|
||||||
once(LOGGER).debug("Output directory {} not created. It {}.", outputFolder, of.exists() ? "already exists." : "may not have appropriate permissions.");
|
once(LOGGER).debug("Output directory {} not created. It {}.", outputFolder, of.exists() ? "already exists." : "may not have appropriate permissions.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -813,7 +813,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
*
|
*
|
||||||
* @param bundle the map which the booleans and collections will be added
|
* @param bundle the map which the booleans and collections will be added
|
||||||
*/
|
*/
|
||||||
void addAuthenticationSwitches(Map<String, Object> bundle){
|
void addAuthenticationSwitches(Map<String, Object> bundle) {
|
||||||
Map<String, SecurityScheme> securitySchemeMap = openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null;
|
Map<String, SecurityScheme> securitySchemeMap = openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null;
|
||||||
List<CodegenSecurity> authMethods = config.fromSecurity(securitySchemeMap);
|
List<CodegenSecurity> authMethods = config.fromSecurity(securitySchemeMap);
|
||||||
if (authMethods != null && !authMethods.isEmpty()) {
|
if (authMethods != null && !authMethods.isEmpty()) {
|
||||||
@ -894,7 +894,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
Map<String, Object> bundle = buildSupportFileBundle(allOperations, allModels);
|
Map<String, Object> bundle = buildSupportFileBundle(allOperations, allModels);
|
||||||
generateSupportingFiles(files, bundle);
|
generateSupportingFiles(files, bundle);
|
||||||
|
|
||||||
if(dryRun) {
|
if (dryRun) {
|
||||||
boolean verbose = Boolean.parseBoolean(GlobalSettings.getProperty("verbose"));
|
boolean verbose = Boolean.parseBoolean(GlobalSettings.getProperty("verbose"));
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
@ -1031,7 +1031,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
if (!absoluteTarget.startsWith(outDir)) {
|
if (!absoluteTarget.startsWith(outDir)) {
|
||||||
throw new RuntimeException(String.format(Locale.ROOT, "Target files must be generated within the output directory; absoluteTarget=%s outDir=%s", absoluteTarget, outDir));
|
throw new RuntimeException(String.format(Locale.ROOT, "Target files must be generated within the output directory; absoluteTarget=%s outDir=%s", absoluteTarget, outDir));
|
||||||
}
|
}
|
||||||
return this.templateProcessor.write(templateData,templateName, target);
|
return this.templateProcessor.write(templateData, templateName, target);
|
||||||
} else {
|
} else {
|
||||||
this.templateProcessor.skip(target.toPath(), String.format(Locale.ROOT, "Skipped by %s options supplied by user.", skippedByOption));
|
this.templateProcessor.skip(target.toPath(), String.format(Locale.ROOT, "Skipped by %s options supplied by user.", skippedByOption));
|
||||||
return null;
|
return null;
|
||||||
@ -1045,7 +1045,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
public Map<String, List<CodegenOperation>> processPaths(Paths paths) {
|
public Map<String, List<CodegenOperation>> processPaths(Paths paths) {
|
||||||
Map<String, List<CodegenOperation>> ops = new TreeMap<>();
|
Map<String, List<CodegenOperation>> ops = new TreeMap<>();
|
||||||
// when input file is not valid and doesn't contain any paths
|
// when input file is not valid and doesn't contain any paths
|
||||||
if(paths == null) {
|
if (paths == null) {
|
||||||
return ops;
|
return ops;
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
|
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
|
||||||
@ -1198,7 +1198,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
allImports.addAll(op.imports);
|
allImports.addAll(op.imports);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String,String> mappings = getAllImportsMappings(allImports);
|
Map<String, String> mappings = getAllImportsMappings(allImports);
|
||||||
Set<Map<String, String>> imports = toImportsObjects(mappings);
|
Set<Map<String, String>> imports = toImportsObjects(mappings);
|
||||||
|
|
||||||
//Some codegen implementations rely on a list interface for the imports
|
//Some codegen implementations rely on a list interface for the imports
|
||||||
@ -1215,16 +1215,17 @@ public class DefaultGenerator implements Generator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms a set of imports to a map with key config.toModelImport(import) and value the import string.
|
* Transforms a set of imports to a map with key config.toModelImport(import) and value the import string.
|
||||||
|
*
|
||||||
* @param allImports - Set of imports
|
* @param allImports - Set of imports
|
||||||
* @return Map of fully qualified import path and initial import.
|
* @return Map of fully qualified import path and initial import.
|
||||||
*/
|
*/
|
||||||
private Map<String,String> getAllImportsMappings(Set<String> allImports){
|
private Map<String, String> getAllImportsMappings(Set<String> allImports) {
|
||||||
Map<String,String> result = new HashMap<>();
|
Map<String, String> result = new HashMap<>();
|
||||||
allImports.forEach(nextImport->{
|
allImports.forEach(nextImport -> {
|
||||||
String mapping = config.importMapping().get(nextImport);
|
String mapping = config.importMapping().get(nextImport);
|
||||||
if(mapping!= null){
|
if (mapping != null) {
|
||||||
result.put(mapping,nextImport);
|
result.put(mapping, nextImport);
|
||||||
}else{
|
} else {
|
||||||
result.putAll(config.toModelImportMap(nextImport));
|
result.putAll(config.toModelImportMap(nextImport));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1238,8 +1239,8 @@ public class DefaultGenerator implements Generator {
|
|||||||
* @param mappedImports Map of fully qualified import and import
|
* @param mappedImports Map of fully qualified import and import
|
||||||
* @return The set of unique imports
|
* @return The set of unique imports
|
||||||
*/
|
*/
|
||||||
private Set<Map<String,String>> toImportsObjects(Map<String,String> mappedImports){
|
private Set<Map<String, String>> toImportsObjects(Map<String, String> mappedImports) {
|
||||||
Set<Map<String, String>> result = new TreeSet<Map<String,String>>(
|
Set<Map<String, String>> result = new TreeSet<Map<String, String>>(
|
||||||
(Comparator<Map<String, String>>) (o1, o2) -> {
|
(Comparator<Map<String, String>>) (o1, o2) -> {
|
||||||
String s1 = o1.get("classname");
|
String s1 = o1.get("classname");
|
||||||
String s2 = o2.get("classname");
|
String s2 = o2.get("classname");
|
||||||
@ -1247,7 +1248,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mappedImports.entrySet().forEach(mapping->{
|
mappedImports.entrySet().forEach(mapping -> {
|
||||||
Map<String, String> im = new LinkedHashMap<>();
|
Map<String, String> im = new LinkedHashMap<>();
|
||||||
im.put("import", mapping.getKey());
|
im.put("import", mapping.getKey());
|
||||||
im.put("classname", mapping.getValue());
|
im.put("classname", mapping.getValue());
|
||||||
|
@ -281,11 +281,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
|
|
||||||
if (null != defaultDocumentationProvider()) {
|
if (null != defaultDocumentationProvider()) {
|
||||||
documentationProvider = DocumentationProvider.ofCliOption(
|
documentationProvider = DocumentationProvider.ofCliOption(
|
||||||
(String)additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
|
(String) additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
|
||||||
defaultDocumentationProvider().toCliOptValue())
|
defaultDocumentationProvider().toCliOptValue())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! supportedDocumentationProvider().contains(documentationProvider)) {
|
if (!supportedDocumentationProvider().contains(documentationProvider)) {
|
||||||
String msg = String.format(Locale.ROOT,
|
String msg = String.format(Locale.ROOT,
|
||||||
"The [%s] Documentation Provider is not supported by this generator",
|
"The [%s] Documentation Provider is not supported by this generator",
|
||||||
documentationProvider.toCliOptValue());
|
documentationProvider.toCliOptValue());
|
||||||
@ -297,13 +297,13 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
documentationProvider.getPreferredAnnotationLibrary().toCliOptValue())
|
documentationProvider.getPreferredAnnotationLibrary().toCliOptValue())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! supportedAnnotationLibraries().contains(annotationLibrary)) {
|
if (!supportedAnnotationLibraries().contains(annotationLibrary)) {
|
||||||
String msg = String.format(Locale.ROOT, "The Annotation Library [%s] is not supported by this generator",
|
String msg = String.format(Locale.ROOT, "The Annotation Library [%s] is not supported by this generator",
|
||||||
annotationLibrary.toCliOptValue());
|
annotationLibrary.toCliOptValue());
|
||||||
throw new IllegalArgumentException(msg);
|
throw new IllegalArgumentException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {
|
if (!documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {
|
||||||
String msg = String.format(Locale.ROOT,
|
String msg = String.format(Locale.ROOT,
|
||||||
"The [%s] documentation provider does not support [%s] as complementary annotation library",
|
"The [%s] documentation provider does not support [%s] as complementary annotation library",
|
||||||
documentationProvider.toCliOptValue(), annotationLibrary.toCliOptValue());
|
documentationProvider.toCliOptValue(), annotationLibrary.toCliOptValue());
|
||||||
|
@ -63,9 +63,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
|
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
|
||||||
public static final String DYNAMIC_OPERATIONS = "dynamicOperations";
|
public static final String DYNAMIC_OPERATIONS = "dynamicOperations";
|
||||||
public static final String SUPPORT_STREAMING = "supportStreaming";
|
public static final String SUPPORT_STREAMING = "supportStreaming";
|
||||||
public static final String GRADLE_PROPERTIES= "gradleProperties";
|
public static final String GRADLE_PROPERTIES = "gradleProperties";
|
||||||
public static final String ERROR_OBJECT_TYPE= "errorObjectType";
|
public static final String ERROR_OBJECT_TYPE = "errorObjectType";
|
||||||
public static final String ERROR_OBJECT_SUBTYPE= "errorObjectSubtype";
|
public static final String ERROR_OBJECT_SUBTYPE = "errorObjectSubtype";
|
||||||
|
|
||||||
public static final String MICROPROFILE_DEFAULT = "default";
|
public static final String MICROPROFILE_DEFAULT = "default";
|
||||||
public static final String MICROPROFILE_KUMULUZEE = "kumuluzee";
|
public static final String MICROPROFILE_KUMULUZEE = "kumuluzee";
|
||||||
@ -329,7 +329,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
additionalProperties.put(ERROR_OBJECT_TYPE, errorObjectType);
|
additionalProperties.put(ERROR_OBJECT_TYPE, errorObjectType);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(ERROR_OBJECT_SUBTYPE)) {
|
if (additionalProperties.containsKey(ERROR_OBJECT_SUBTYPE)) {
|
||||||
this.setErrorObjectSubtype((List<String>)additionalProperties.get(ERROR_OBJECT_SUBTYPE));
|
this.setErrorObjectSubtype((List<String>) additionalProperties.get(ERROR_OBJECT_SUBTYPE));
|
||||||
}
|
}
|
||||||
additionalProperties.put(ERROR_OBJECT_SUBTYPE, errorObjectSubtype);
|
additionalProperties.put(ERROR_OBJECT_SUBTYPE, errorObjectSubtype);
|
||||||
|
|
||||||
@ -979,15 +979,15 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setGradleProperties(final String gradleProperties) {
|
public void setGradleProperties(final String gradleProperties) {
|
||||||
this.gradleProperties= gradleProperties;
|
this.gradleProperties = gradleProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorObjectType(final String errorObjectType) {
|
public void setErrorObjectType(final String errorObjectType) {
|
||||||
this.errorObjectType= errorObjectType;
|
this.errorObjectType = errorObjectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorObjectSubtype(final List<String> errorObjectSubtype) {
|
public void setErrorObjectSubtype(final List<String> errorObjectSubtype) {
|
||||||
this.errorObjectSubtype= errorObjectSubtype;
|
this.errorObjectSubtype = errorObjectSubtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,10 +20,12 @@ package org.openapitools.codegen.java;
|
|||||||
import io.swagger.v3.oas.models.Components;
|
import io.swagger.v3.oas.models.Components;
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.media.*;
|
import io.swagger.v3.oas.models.media.*;
|
||||||
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.openapitools.codegen.CodegenConstants;
|
import org.openapitools.codegen.CodegenConstants;
|
||||||
import org.openapitools.codegen.CodegenModel;
|
import org.openapitools.codegen.CodegenModel;
|
||||||
import org.openapitools.codegen.CodegenParameter;
|
import org.openapitools.codegen.CodegenParameter;
|
||||||
@ -529,7 +531,6 @@ public class AbstractJavaCodegenTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test(description = "tests if default version with snapshot is used when setArtifactVersion is used")
|
@Test(description = "tests if default version with snapshot is used when setArtifactVersion is used")
|
||||||
public void snapshotVersionAlreadySnapshotTest() {
|
public void snapshotVersionAlreadySnapshotTest() {
|
||||||
final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen();
|
final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen();
|
||||||
@ -543,6 +544,7 @@ public class AbstractJavaCodegenTest {
|
|||||||
|
|
||||||
Assert.assertEquals(codegen.getArtifactVersion(), "4.1.2-SNAPSHOT");
|
Assert.assertEquals(codegen.getArtifactVersion(), "4.1.2-SNAPSHOT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toDefaultValueDateTimeLegacyTest() {
|
public void toDefaultValueDateTimeLegacyTest() {
|
||||||
final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen();
|
final P_AbstractJavaCodegen codegen = new P_AbstractJavaCodegen();
|
||||||
@ -551,7 +553,7 @@ public class AbstractJavaCodegenTest {
|
|||||||
|
|
||||||
// Test default value for date format
|
// Test default value for date format
|
||||||
DateSchema dateSchema = new DateSchema();
|
DateSchema dateSchema = new DateSchema();
|
||||||
LocalDate defaultLocalDate = LocalDate.of(2019,2,15);
|
LocalDate defaultLocalDate = LocalDate.of(2019, 2, 15);
|
||||||
Date date = Date.from(defaultLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
Date date = Date.from(defaultLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||||
dateSchema.setDefault(date);
|
dateSchema.setDefault(date);
|
||||||
defaultValue = codegen.toDefaultValue(dateSchema);
|
defaultValue = codegen.toDefaultValue(dateSchema);
|
||||||
@ -607,7 +609,7 @@ public class AbstractJavaCodegenTest {
|
|||||||
|
|
||||||
// Test default value for date format
|
// Test default value for date format
|
||||||
DateSchema dateSchema = new DateSchema();
|
DateSchema dateSchema = new DateSchema();
|
||||||
LocalDate defaultLocalDate = LocalDate.of(2019,2,15);
|
LocalDate defaultLocalDate = LocalDate.of(2019, 2, 15);
|
||||||
Date date = Date.from(defaultLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
Date date = Date.from(defaultLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||||
dateSchema.setDefault(date);
|
dateSchema.setDefault(date);
|
||||||
defaultValue = codegen.toDefaultValue(dateSchema);
|
defaultValue = codegen.toDefaultValue(dateSchema);
|
||||||
|
@ -406,8 +406,8 @@ public class JavaModelTest {
|
|||||||
Assert.assertTrue(property.isContainer);
|
Assert.assertTrue(property.isContainer);
|
||||||
|
|
||||||
final CodegenProperty itemsProperty = property.items;
|
final CodegenProperty itemsProperty = property.items;
|
||||||
Assert.assertEquals(itemsProperty.baseName,"child");
|
Assert.assertEquals(itemsProperty.baseName, "child");
|
||||||
Assert.assertEquals(itemsProperty.name,"child");
|
Assert.assertEquals(itemsProperty.name, "child");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(description = "convert an array model")
|
@Test(description = "convert an array model")
|
||||||
@ -745,7 +745,7 @@ public class JavaModelTest {
|
|||||||
|
|
||||||
@DataProvider(name = "modelNames")
|
@DataProvider(name = "modelNames")
|
||||||
public static Object[][] primeNumbers() {
|
public static Object[][] primeNumbers() {
|
||||||
return new Object[][] {
|
return new Object[][]{
|
||||||
{"sample", "Sample"},
|
{"sample", "Sample"},
|
||||||
{"sample_name", "SampleName"},
|
{"sample_name", "SampleName"},
|
||||||
{"sample__name", "SampleName"},
|
{"sample__name", "SampleName"},
|
||||||
@ -771,7 +771,7 @@ public class JavaModelTest {
|
|||||||
|
|
||||||
@DataProvider(name = "classProperties")
|
@DataProvider(name = "classProperties")
|
||||||
public static Object[][] classProperties() {
|
public static Object[][] classProperties() {
|
||||||
return new Object[][] {
|
return new Object[][]{
|
||||||
{"class", "getPropertyClass", "setPropertyClass", "propertyClass"},
|
{"class", "getPropertyClass", "setPropertyClass", "propertyClass"},
|
||||||
{"_class", "getPropertyClass", "setPropertyClass", "propertyClass"},
|
{"_class", "getPropertyClass", "setPropertyClass", "propertyClass"},
|
||||||
{"__class", "getPropertyClass", "setPropertyClass", "propertyClass"}
|
{"__class", "getPropertyClass", "setPropertyClass", "propertyClass"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user