Adds a validateAndCast(json, typeNameOrId) method to the JSON schema validator. This method throws an error if the given object does not validate against the given schema identifier. If validation passes, the object is automatically cast to the appropriate typescript type.
Note: This method throws a ValidatorError, NOT a StatusError. If this method is used by an OPR server, the resulting exception should be caught and rethrown as an appropriate StatusError.
Adds a
validateAndCast(json, typeNameOrId)
method to the JSON schema validator. This method throws an error if the given object does not validate against the given schema identifier. If validation passes, the object is automatically cast to the appropriate typescript type.Note: This method throws a ValidatorError, NOT a StatusError. If this method is used by an OPR server, the resulting exception should be caught and rethrown as an appropriate StatusError.