Pip-Services-Commons-Dotnet
|
Schema to validate object properties More...
Public Member Functions | |
PropertySchema () | |
Creates a new validation schema. More... | |
PropertySchema (string name, object type) | |
Creates a new validation schema and sets its values. More... | |
![]() | |
Schema () | |
Creates a new instance of validation schema. More... | |
Schema (bool required, List< IValidationRule > rules) | |
Creates a new instance of validation schema and sets its values. More... | |
Schema | MakeRequired () |
Makes validated values always required (non-null). For null values the schema will raise errors. More... | |
Schema | MakeOptional () |
Makes validated values optional. Validation for null values will be skipped. More... | |
Schema | WithRule (IValidationRule rule) |
Adds validation rule to this schema. This method returns reference to this exception to implement Builder pattern to chain additional calls. More... | |
List< ValidationResult > | Validate (object value) |
Validates the given value and results validation results. More... | |
void | ValidateAndThrowException (string correlationId, object value, bool strict=false) |
Validates the given value and returns a ValidationException if errors were found. More... | |
Properties | |
string | Name [get, set] |
object | Type [get, set] |
![]() | |
bool | IsRequired [get, set] |
List< IValidationRule > | Rules [get, set] |
Additional Inherited Members | |
![]() | |
void | PerformTypeValidation (string path, object type, object value, List< ValidationResult > results) |
Validates a given value to match specified type. The type can be defined as a Schema, type, a type name or TypeCode When type is a Schema, it executes validation recursively against that Schema. More... | |
Schema to validate object properties
PipServices3.Commons.Validate.PropertySchema.PropertySchema | ( | ) |
Creates a new validation schema.
PipServices3.Commons.Validate.PropertySchema.PropertySchema | ( | string | name, |
object | type | ||
) |
Creates a new validation schema and sets its values.
name | (optional) a property name |
type | (optional) a property type |