public static JSchema OpenSchemaFile(string name, JSchemaResolver resolver = null) { using (Stream file = OpenFile(name)) using (JsonReader reader = new JsonTextReader(new StreamReader(file))) { JSchema schema = (resolver != null) ? JSchema.Load(reader, resolver) : JSchema.Load(reader); return(schema); } }
public static JSchema OpenSchemaResource(string name, JSchemaResolver resolver) { Stream s = OpenResource("Schemas." + name); using (JsonReader reader = new JsonTextReader(new StreamReader(s))) { JSchemaReader schemaReader = new JSchemaReader(resolver); return(schemaReader.ReadRoot(reader)); } }
public JSchemaReader(JSchemaReaderSettings settings) { Cache = new Dictionary <Uri, JSchema>(UriComparer.Instance); _deferedSchemas = new List <DeferedSchema>(); _schemaStack = new Stack <JSchema>(); _resolver = settings.Resolver ?? JSchemaDummyResolver.Instance; _baseUri = settings.BaseUri; _validateSchema = settings.ValidateVersion; }
public static JSchema OpenSchemaFile(string name, JSchemaResolver resolver) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string path = Path.Combine(baseDirectory, name); using (JsonReader reader = new JsonTextReader(new StreamReader(path))) { JSchema schema = JSchema.Load(reader, resolver); return(schema); } }
public static JSchema OpenSchemaFile(string name, JSchemaResolver resolver = null) { string path = ResolveFilePath(name); using (Stream file = File.OpenRead(path)) using (JsonReader reader = new JsonTextReader(new StreamReader(file))) { JSchema schema = JSchema.Load(reader, new JSchemaReaderSettings { Resolver = resolver, BaseUri = new Uri(path, UriKind.RelativeOrAbsolute) }); return schema; } }
public static JSchema OpenSchemaFile(string name, JSchemaResolver resolver = null) { string path = ResolveFilePath(name); using (Stream file = File.OpenRead(path)) using (JsonReader reader = new JsonTextReader(new StreamReader(file))) { JSchema schema = JSchema.Load(reader, new JSchemaReaderSettings { Resolver = resolver, BaseUri = new Uri(path, UriKind.RelativeOrAbsolute) }); return(schema); } }
public static JSchema OpenSchemaFile(string name, JSchemaResolver resolver, Uri baseUri = null) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string path = Path.Combine(baseDirectory, name); using (JsonReader reader = new JsonTextReader(new StreamReader(path))) { JSchema schema = JSchema.Load(reader, new JSchemaReaderSettings { BaseUri = baseUri ?? new Uri(path, UriKind.RelativeOrAbsolute), Resolver = resolver }); return schema; } }
public JSchemaReader(JSchemaReaderSettings settings) { Cache = new Dictionary <Uri, JSchema>(UriComparer.Instance); _deferedSchemas = new List <DeferedSchema>(); _schemaStack = new Stack <JSchema>(); _resolver = settings.Resolver ?? JSchemaDummyResolver.Instance; _baseUri = settings.BaseUri; _validateSchema = settings.ValidateVersion; _schemaDiscovery = new JSchemaDiscovery(); _validationEventHandler = settings.GetValidationEventHandler(); if (_validationEventHandler != null) { _validationErrors = new List <ValidationError>(); _schemaDiscovery.ValidationErrors = _validationErrors; } }
public JSchemaReader(JSchemaResolver resolver) : this(new JSchemaReaderSettings { Resolver = resolver }) { }
public JSchemaReader(JSchemaResolver resolver) { _resolver = resolver; _deferedSchemas = new List <DeferedSchema>(); _schemaStack = new Stack <JSchema>(); }
public StacSchemaResolver(JSchemaResolver jSchemaResolver) { this.jSchemaResolver = jSchemaResolver; this.schemaCompiled = new Dictionary <string, JSchema>(); }