You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To mirror the functional API for Concerto, we need to implement validation of a JSON object against a model definition.
Use Case
Validation is a key operation of a schema language, and is used to determine whether data is valid with respect to the model and the language specification.
Possible Solution
The existing (empty) AccordProject.Concerto namespace should have a public class added that contains a validate operation with the following signature:
Note that this is not a binary operation, i.e. there is no true/false response depending on the outcome of validation. Instead, a validation of a valid object will return successfully and validation of an invalid object will throw an exception that contains details of why the validation failed.
Context
The reference implementation for this is in the JS version of Concerto.
It is critical that implementations of Concerto for different runtimes have the same semantics and very close signatures. Extensions to the language should be avoided until parity is achieved with the JS implementation. It is expected that the JS implementation will continue to be the reference implementation for some time.
Detailed Description
A proper implementation of validation will also require porting of the ModelManager and associated introspection Classes (see #4).
Dates are specified according to the ISO 8601 standard. We adopt the DayJS library which supports the following formats This spec must be respected in the .NET port. All of the following are valid date formats in Concerto.
Regular expressions use the ECMAScript flavour, any validation of Regular Expressions in field validators should be performed in ECMAScript compatibility mode.
Error messages and console logs must not include any values from the input data, e.g. accordproject/concerto#483
The text was updated successfully, but these errors were encountered:
Feature Request 🛍️
To mirror the functional API for Concerto, we need to implement validation of a JSON object against a model definition.
Use Case
Validation is a key operation of a schema language, and is used to determine whether data is valid with respect to the model and the language specification.
Possible Solution
The existing (empty)
AccordProject.Concerto
namespace should have a public class added that contains avalidate
operation with the following signature:Note that this is not a binary operation, i.e. there is no
true
/false
response depending on the outcome of validation. Instead, a validation of a valid object will return successfully and validation of an invalid object will throw an exception that contains details of why the validation failed.Context
The reference implementation for this is in the JS version of Concerto.
It is critical that implementations of Concerto for different runtimes have the same semantics and very close signatures. Extensions to the language should be avoided until parity is achieved with the JS implementation. It is expected that the JS implementation will continue to be the reference implementation for some time.
Detailed Description
A proper implementation of validation will also require porting of the ModelManager and associated introspection Classes (see #4).
Existing unit tests, which should be ported
Dates are specified according to the ISO 8601 standard. We adopt the DayJS library which supports the following formats This spec must be respected in the .NET port. All of the following are valid date formats in Concerto.
Regular expressions use the ECMAScript flavour, any validation of Regular Expressions in field validators should be performed in ECMAScript compatibility mode.
Error messages and console logs must not include any values from the input data, e.g. accordproject/concerto#483
The text was updated successfully, but these errors were encountered: