diff --git a/NodeTypes.Schema.json b/NodeTypes.Schema.json index 89988fe..532ff0a 100644 --- a/NodeTypes.Schema.json +++ b/NodeTypes.Schema.json @@ -849,11 +849,17 @@ } }, "simpleValidator": { + "$comment": "This is the base validator definition for all validators. It is extended by the actual validators below.", "type": [ "object", "null" ], - "additionalProperties": false + "properties": { + "validationErrorMessage": { + "type": "string", + "description": "The custom error message to be shown if the validation fails. Neos 8.0+" + } + } }, "validation": { "type": [ @@ -869,24 +875,20 @@ }, "properties": { "Neos.Neos/Validation/BooleanValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "expectedValue": { "type": "boolean" } } }, "Neos.Neos/Validation/DateTimeValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "locale": { "type": "string" }, @@ -912,12 +914,10 @@ } }, "Neos.Neos/Validation/DateTimeRangeValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "earliestDate": { "type": "string" }, @@ -927,12 +927,10 @@ } }, "Neos.Neos/Validation/EmailAddressValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "strict": { "type": "boolean" }, @@ -942,24 +940,38 @@ } }, "Neos.Neos/Validation/FloatValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/IntegerValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/LabelValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/LocaleIdentifierValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/NumberValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "locale": { "type": "string" }, @@ -985,12 +997,10 @@ } }, "Neos.Neos/Validation/NumberRangeValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "minimum": { "type": "integer", "minimum": 0 @@ -1002,33 +1012,34 @@ } }, "Neos.Neos/Validation/NotEmptyValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/RegularExpressionValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "regularExpression": { "type": "string" - }, - "validationErrorMessage": { - "type": "string" } } }, "Neos.Neos/Validation/StringValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/StringLengthValidator": { - "type": [ - "object", - "null" - ], + "$ref": "#/definitions/simpleValidator", "additionalProperties": false, "properties": { + "validationErrorMessage": true, "minimum": { "type": "integer", "minimum": 0 @@ -1043,10 +1054,18 @@ } }, "Neos.Neos/Validation/TextValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } }, "Neos.Neos/Validation/UuidValidator": { - "$ref": "#/definitions/simpleValidator" + "$ref": "#/definitions/simpleValidator", + "additionalProperties": false, + "properties": { + "validationErrorMessage": true + } } } }, diff --git a/examples/NodeTypes.Validators.yaml b/examples/NodeTypes.Validators.yaml index 614a1f8..1f4e408 100644 --- a/examples/NodeTypes.Validators.yaml +++ b/examples/NodeTypes.Validators.yaml @@ -10,40 +10,53 @@ My.Vendor:Content.Validators: validation: My.Custom/Validator: myCustomProperty: true - Neos.Neos/Validation/BooleanValidator: expectedValue: false + validationErrorMessage: 'Please enter a boolean' Neos.Neos/Validation/DateTimeValidator: locale: en strictMode: false formatLength: default formatType: date + validationErrorMessage: 'Please enter a valid datetime' Neos.Neos/Validation/DateTimeRangeValidator: earliestDate: 1.1.2000 latestDate: 2.1.2000 + validationErrorMessage: 'Please enter a valid datetime in the range of x and y' Neos.Neos/Validation/EmailAddressValidator: checkDns: false strict: false - Neos.Neos/Validation/FloatValidator: { } - Neos.Neos/Validation/IntegerValidator: { } - Neos.Neos/Validation/LabelValidator: { } - Neos.Neos/Validation/LocaleIdentifierValidator: { } - Neos.Neos/Validation/NotEmptyValidator: { } + validationErrorMessage: 'Please enter a valid email address' + Neos.Neos/Validation/FloatValidator: + validationErrorMessage: 'Please enter a valid float' + Neos.Neos/Validation/IntegerValidator: + validationErrorMessage: 'Please enter a valid integer' + Neos.Neos/Validation/LabelValidator: + validationErrorMessage: 'Please enter a valid label' + Neos.Neos/Validation/LocaleIdentifierValidator: + validationErrorMessage: 'Please enter a valid locale' + Neos.Neos/Validation/NotEmptyValidator: + validationErrorMessage: 'Please enter a value' Neos.Neos/Validation/NumberValidator: locale: en strictMode: false formatLength: default formatType: decimal + validationErrorMessage: 'Please enter a number' Neos.Neos/Validation/NumberRangeValidator: minimum: 0 maximum: 2 Neos.Neos/Validation/RegularExpressionValidator: regularExpression: '/^[a-z0-9\-]+$/i' validationErrorMessage: 'Please enter only lowercase letters, numbers or minus' - Neos.Neos/Validation/StringValidator: {} + Neos.Neos/Validation/StringValidator: + validationErrorMessage: 'Please enter a valid string' Neos.Neos/Validation/StringLengthValidator: minimum: 0 maximum: 1 ignoreHtml: false - Neos.Neos/Validation/TextValidator: { } - Neos.Neos/Validation/UuidValidator: { } + validationErrorMessage: 'Please enter a valid string between x and y characters' + Neos.Neos/Validation/TextValidator: + validationErrorMessage: 'Please enter a valid text' + Neos.Neos/Validation/UuidValidator: + validationErrorMessage: 'Please enter a valid uuid'