|
26 | 26 | import java.util.Map;
|
27 | 27 |
|
28 | 28 | public enum ValidatorTypeCode implements Keyword, ErrorMessageType {
|
29 |
| - ADDITIONAL_PROPERTIES("additionalProperties", "1001", new MessageFormat( |
30 |
| - "{0}.{1}: is not defined in the schema and the schema does not allow additional properties"), AdditionalPropertiesValidator.class, 15), // v4|v6|v7|v201909 |
31 |
| - ALL_OF("allOf", "1002", new MessageFormat("{0}: should be valid to all the schemas {1}"), AllOfValidator.class, 15), |
32 |
| - ANY_OF("anyOf", "1003", new MessageFormat("{0}: should be valid to any of the schemas {1}"), AnyOfValidator.class, 15), |
33 |
| - CROSS_EDITS("crossEdits", "1004", new MessageFormat("{0}: has an error with 'cross edits'"), null, 15), |
34 |
| - DEPENDENCIES("dependencies", "1007", new MessageFormat("{0}: has an error with dependencies {1}"), DependenciesValidator.class, 15), |
35 |
| - EDITS("edits", "1005", new MessageFormat("{0}: has an error with 'edits'"), null, 15), |
36 |
| - ENUM("enum", "1008", new MessageFormat("{0}: does not have a value in the enumeration {1}"), EnumValidator.class, 15), |
37 |
| - FORMAT("format", "1009", new MessageFormat("{0}: does not match the {1} pattern {2}"), null, 15) { |
| 29 | + ADDITIONAL_PROPERTIES("additionalProperties", "1001", new MessageFormat(I18nSupport.getString("additionalProperties")), AdditionalPropertiesValidator.class, 15), // v4|v6|v7|v201909 |
| 30 | + ALL_OF("allOf", "1002", new MessageFormat(I18nSupport.getString("allOf")), AllOfValidator.class, 15), |
| 31 | + ANY_OF("anyOf", "1003", new MessageFormat(I18nSupport.getString("anyOf")), AnyOfValidator.class, 15), |
| 32 | + CROSS_EDITS("crossEdits", "1004", new MessageFormat(I18nSupport.getString("crossEdits")), null, 15), |
| 33 | + DEPENDENCIES("dependencies", "1007", new MessageFormat(I18nSupport.getString("dependencies")), DependenciesValidator.class, 15), |
| 34 | + EDITS("edits", "1005", new MessageFormat(I18nSupport.getString("edits")), null, 15), |
| 35 | + ENUM("enum", "1008", new MessageFormat(I18nSupport.getString("enum")), EnumValidator.class, 15), |
| 36 | + FORMAT("format", "1009", new MessageFormat(I18nSupport.getString("format")), null, 15) { |
38 | 37 | @Override
|
39 | 38 | public JsonValidator newValidator(String schemaPath, JsonNode schemaNode, JsonSchema parentSchema, ValidationContext validationContext)
|
40 | 39 | throws Exception {
|
41 | 40 | throw new UnsupportedOperationException("Use FormatKeyword instead");
|
42 | 41 | }
|
43 | 42 | },
|
44 |
| - ITEMS("items", "1010", new MessageFormat("{0}[{1}]: no validator found at this index"), ItemsValidator.class, 15), |
45 |
| - MAXIMUM("maximum", "1011", new MessageFormat("{0}: must have a maximum value of {1}"), MaximumValidator.class, 15), |
46 |
| - MAX_ITEMS("maxItems", "1012", new MessageFormat("{0}: there must be a maximum of {1} items in the array"), MaxItemsValidator.class, 15), |
47 |
| - MAX_LENGTH("maxLength", "1013", new MessageFormat("{0}: may only be {1} characters long"), MaxLengthValidator.class, 15), |
48 |
| - MAX_PROPERTIES("maxProperties", "1014", new MessageFormat("{0}: may only have a maximum of {1} properties"), MaxPropertiesValidator.class, 15), |
49 |
| - MINIMUM("minimum", "1015", new MessageFormat("{0}: must have a minimum value of {1}"), MinimumValidator.class, 15), |
50 |
| - MIN_ITEMS("minItems", "1016", new MessageFormat("{0}: there must be a minimum of {1} items in the array"), MinItemsValidator.class, 15), |
51 |
| - MIN_LENGTH("minLength", "1017", new MessageFormat("{0}: must be at least {1} characters long"), MinLengthValidator.class, 15), |
52 |
| - MIN_PROPERTIES("minProperties", "1018", new MessageFormat("{0}: should have a minimum of {1} properties"), MinPropertiesValidator.class, 15), |
53 |
| - MULTIPLE_OF("multipleOf", "1019", new MessageFormat("{0}: must be multiple of {1}"), MultipleOfValidator.class, 15), |
54 |
| - NOT_ALLOWED("notAllowed", "1033", new MessageFormat("{0}.{1}: is not allowed but it is in the data"), NotAllowedValidator.class, 15), |
55 |
| - NOT("not", "1020", new MessageFormat("{0}: should not be valid to the schema {1}"), NotValidator.class, 15), |
56 |
| - ONE_OF("oneOf", "1022", new MessageFormat("{0}: should be valid to one and only one of the schemas {1}"), OneOfValidator.class, 15), |
57 |
| - PATTERN_PROPERTIES("patternProperties", "1024", new MessageFormat("{0}: has some error with 'pattern properties'"), PatternPropertiesValidator.class, 15), |
58 |
| - PATTERN("pattern", "1023", new MessageFormat("{0}: does not match the regex pattern {1}"), PatternValidator.class, 15), |
59 |
| - PROPERTIES("properties", "1025", new MessageFormat("{0}: has an error with 'properties'"), PropertiesValidator.class, 15), |
60 |
| - READ_ONLY("readOnly", "1032", new MessageFormat("{0}: is a readonly field, it cannot be changed"), ReadOnlyValidator.class, 15), |
61 |
| - REF("$ref", "1026", new MessageFormat("{0}: has an error with 'refs'"), RefValidator.class, 15), |
62 |
| - REQUIRED("required", "1028", new MessageFormat("{0}.{1}: is missing but it is required"), RequiredValidator.class, 15), |
63 |
| - TYPE("type", "1029", new MessageFormat("{0}: {1} found, {2} expected"), TypeValidator.class, 15), |
64 |
| - UNION_TYPE("unionType", "1030", new MessageFormat("{0}: {1} found, but {2} is required"), UnionTypeValidator.class, 15), |
65 |
| - UNIQUE_ITEMS("uniqueItems", "1031", new MessageFormat("{0}: the items in the array must be unique"), UniqueItemsValidator.class, 15), |
| 43 | + ITEMS("items", "1010", new MessageFormat(I18nSupport.getString("items")), ItemsValidator.class, 15), |
| 44 | + MAXIMUM("maximum", "1011", new MessageFormat(I18nSupport.getString("maximum")), MaximumValidator.class, 15), |
| 45 | + MAX_ITEMS("maxItems", "1012", new MessageFormat(I18nSupport.getString("maxItems")), MaxItemsValidator.class, 15), |
| 46 | + MAX_LENGTH("maxLength", "1013", new MessageFormat(I18nSupport.getString("maxLength")), MaxLengthValidator.class, 15), |
| 47 | + MAX_PROPERTIES("maxProperties", "1014", new MessageFormat(I18nSupport.getString("maxProperties")), MaxPropertiesValidator.class, 15), |
| 48 | + MINIMUM("minimum", "1015", new MessageFormat(I18nSupport.getString("minimum")), MinimumValidator.class, 15), |
| 49 | + MIN_ITEMS("minItems", "1016", new MessageFormat(I18nSupport.getString("minItems")), MinItemsValidator.class, 15), |
| 50 | + MIN_LENGTH("minLength", "1017", new MessageFormat(I18nSupport.getString("minLength")), MinLengthValidator.class, 15), |
| 51 | + MIN_PROPERTIES("minProperties", "1018", new MessageFormat(I18nSupport.getString("minProperties")), MinPropertiesValidator.class, 15), |
| 52 | + MULTIPLE_OF("multipleOf", "1019", new MessageFormat(I18nSupport.getString("multipleOf")), MultipleOfValidator.class, 15), |
| 53 | + NOT_ALLOWED("notAllowed", "1033", new MessageFormat(I18nSupport.getString("notAllowed")), NotAllowedValidator.class, 15), |
| 54 | + NOT("not", "1020", new MessageFormat(I18nSupport.getString("not")), NotValidator.class, 15), |
| 55 | + ONE_OF("oneOf", "1022", new MessageFormat(I18nSupport.getString("oneOf")), OneOfValidator.class, 15), |
| 56 | + PATTERN_PROPERTIES("patternProperties", "1024", new MessageFormat(I18nSupport.getString("patternProperties")), PatternPropertiesValidator.class, 15), |
| 57 | + PATTERN("pattern", "1023", new MessageFormat(I18nSupport.getString("pattern")), PatternValidator.class, 15), |
| 58 | + PROPERTIES("properties", "1025", new MessageFormat(I18nSupport.getString("properties")), PropertiesValidator.class, 15), |
| 59 | + READ_ONLY("readOnly", "1032", new MessageFormat(I18nSupport.getString("readOnly")), ReadOnlyValidator.class, 15), |
| 60 | + REF("$ref", "1026", new MessageFormat(I18nSupport.getString("$ref")), RefValidator.class, 15), |
| 61 | + REQUIRED("required", "1028", new MessageFormat(I18nSupport.getString("required")), RequiredValidator.class, 15), |
| 62 | + TYPE("type", "1029", new MessageFormat(I18nSupport.getString("type")), TypeValidator.class, 15), |
| 63 | + UNION_TYPE("unionType", "1030", new MessageFormat(I18nSupport.getString("unionType")), UnionTypeValidator.class, 15), |
| 64 | + UNIQUE_ITEMS("uniqueItems", "1031", new MessageFormat(I18nSupport.getString("uniqueItems")), UniqueItemsValidator.class, 15), |
66 | 65 | DATETIME("date-time", "1034", new MessageFormat("{0}: {1} is an invalid {2}"), null, 15),
|
67 |
| - UUID("uuid", "1035", new MessageFormat("{0}: {1} is an invalid {2}"), null, 15), |
68 |
| - ID("id", "1036", new MessageFormat("{0}: {1} is an invalid segment for URI {2}"), null, 15), |
| 66 | + UUID("uuid", "1035", new MessageFormat(I18nSupport.getString("uuid")), null, 15), |
| 67 | + ID("id", "1036", new MessageFormat(I18nSupport.getString("id")), null, 15), |
69 | 68 | IF_THEN_ELSE("if", "1037", null, IfValidator.class, 12), // V7|V201909
|
70 |
| - EXCLUSIVE_MAXIMUM("exclusiveMaximum", "1038", new MessageFormat("{0}: must have a exclusive maximum value of {1}"), ExclusiveMaximumValidator.class, 14), // V6|V7|V201909 |
71 |
| - EXCLUSIVE_MINIMUM("exclusiveMinimum", "1039", new MessageFormat("{0}: must have a exclusive minimum value of {1}"), ExclusiveMinimumValidator.class, 14), |
| 69 | + EXCLUSIVE_MAXIMUM("exclusiveMaximum", "1038", new MessageFormat(I18nSupport.getString("exclusiveMaximum")), ExclusiveMaximumValidator.class, 14), // V6|V7|V201909 |
| 70 | + EXCLUSIVE_MINIMUM("exclusiveMinimum", "1039", new MessageFormat(I18nSupport.getString("exclusiveMinimum")), ExclusiveMinimumValidator.class, 14), |
72 | 71 | TRUE("true", "1040", null, TrueValidator.class, 14),
|
73 |
| - FALSE("false", "1041", new MessageFormat("Boolean schema false is not valid"), FalseValidator.class, 14), |
74 |
| - CONST("const", "1042", new MessageFormat("{0}: must be a constant value {1}"), ConstValidator.class, 14), |
75 |
| - CONTAINS("contains", "1043", new MessageFormat("{0}: does not contain an element that passes these validations: {1}"), ContainsValidator.class, 14), |
76 |
| - PROPERTYNAMES("propertyNames", "1044", new MessageFormat("Property name {0} is not valid for validation: {1}"), PropertyNamesValidator.class, 14); |
| 72 | + FALSE("false", "1041", new MessageFormat(I18nSupport.getString("false")), FalseValidator.class, 14), |
| 73 | + CONST("const", "1042", new MessageFormat(I18nSupport.getString("const")), ConstValidator.class, 14), |
| 74 | + CONTAINS("contains", "1043", new MessageFormat(I18nSupport.getString("contains")), ContainsValidator.class, 14), |
| 75 | + PROPERTYNAMES("propertyNames", "1044", new MessageFormat(I18nSupport.getString("propertyNames")), PropertyNamesValidator.class, 14); |
77 | 76 |
|
78 | 77 | private static Map<String, ValidatorTypeCode> constants = new HashMap<String, ValidatorTypeCode>();
|
79 | 78 | private static SpecVersion specVersion = new SpecVersion();
|
|
0 commit comments