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