add methods to validate the ruby object

This commit is contained in:
wing328
2016-04-25 19:18:05 +08:00
parent 3c36f1df37
commit e17a620506
18 changed files with 439 additions and 28 deletions

View File

@@ -42,7 +42,7 @@ public class CodegenProperty {
public Map<String, Object> allowableValues;
public CodegenProperty items;
public Map<String, Object> vendorExtensions;
public Boolean needValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
public Boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
@Override
public int hashCode()

View File

@@ -1106,7 +1106,7 @@ public class DefaultCodegen {
// check if any validation rule defined
if (property.minimum != null || property.maximum != null || property.exclusiveMinimum != null || property.exclusiveMaximum != null)
property.needValidation = true;
property.hasValidation = true;
// legacy support
Map<String, Object> allowableValues = new HashMap<String, Object>();
@@ -1129,7 +1129,7 @@ public class DefaultCodegen {
// check if any validation rule defined
if (property.pattern != null || property.minLength != null || property.maxLength != null)
property.needValidation = true;
property.hasValidation = true;
property.isString = true;
if (sp.getEnum() != null) {