forked from loafle/openapi-generator-original
add validation to method parameters
This commit is contained in:
@@ -121,6 +121,7 @@ public class CodegenParameter {
|
||||
output.items = this.items;
|
||||
}
|
||||
output.vendorExtensions = this.vendorExtensions;
|
||||
output.hasValidation = this.hasValidation;
|
||||
output.isBinary = this.isBinary;
|
||||
output.isByteArray = this.isByteArray;
|
||||
output.isString = this.isString;
|
||||
|
||||
@@ -86,6 +86,7 @@ public class CodegenProperty {
|
||||
result = prime * result + ((setter == null) ? 0 : setter.hashCode());
|
||||
result = prime * result + ((unescapedDescription == null) ? 0 : unescapedDescription.hashCode());
|
||||
result = prime * result + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode());
|
||||
result = prime * result + ((hasValidation == null) ? 0 : hasValidation.hashCode());
|
||||
result = prime * result + ((isString == null) ? 0 : isString.hashCode());
|
||||
result = prime * result + ((isInteger == null) ? 0 : isInteger.hashCode());
|
||||
result = prime * result + ((isLong == null) ? 0 : isLong.hashCode());
|
||||
@@ -203,12 +204,19 @@ public class CodegenProperty {
|
||||
if (this.allowableValues != other.allowableValues && (this.allowableValues == null || !this.allowableValues.equals(other.allowableValues))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.vendorExtensions != other.vendorExtensions && (this.vendorExtensions == null || !this.vendorExtensions.equals(other.vendorExtensions))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.hasValidation != other.hasValidation && (this.hasValidation == null || !this.hasValidation.equals(other.hasValidation))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isString != other.isString && (this.isString == null || !this.isString.equals(other.isString))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isInteger != other.isInteger && (this.isInteger == null || !this.isInteger.equals(other.isInteger))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1838,7 +1838,10 @@ public class DefaultCodegen {
|
||||
p.minimum != null || p.exclusiveMinimum != null ||
|
||||
p.maxLength != null || p.minLength != null ||
|
||||
p.maxItems != null || p.minItems != null ||
|
||||
p.pattern != null ||
|
||||
p.pattern != null) {
|
||||
p.hasValidation = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!(param instanceof BodyParameter)) {
|
||||
LOGGER.error("Cannot use Parameter " + param + " as Body Parameter");
|
||||
|
||||
Reference in New Issue
Block a user