public void RaiseError(string message, ErrorType errorType, JSchema schema, object value, IList <ValidationError> childErrors) { ValidationError error = CreateError(message, errorType, schema, value, childErrors); SchemaValidationEventHandler handler = ValidationEventHandler; if (handler != null) { handler(_publicValidator, new SchemaValidationEventArgs(error)); } else { throw JSchemaException.Create(message, error); } }
public static Uri ResolveSchemaIdAndScopeId(Uri idScope, JSchema schema, string path, out Uri newScope) { Uri schemaId = schema.Id; Uri knownSchemaId; if (schemaId != null) { try { newScope = SchemaDiscovery.ResolveSchemaId(idScope, schemaId); } catch (Exception ex) { string message = "Error resolving schema ID '{0}' in the current scope. The resolved ID must be a valid URI.".FormatWith(CultureInfo.InvariantCulture, schemaId); throw new JSchemaException(JSchemaException.FormatMessage(schema, schema.Path, message), ex); } knownSchemaId = newScope; } else { if (idScope == null) { knownSchemaId = new Uri(path, UriKind.RelativeOrAbsolute); } else { knownSchemaId = SchemaDiscovery.ResolveSchemaId(idScope, new Uri(path, UriKind.RelativeOrAbsolute)); } newScope = idScope; } return(knownSchemaId); }