Ejemplo n.º 1
0
 public JsonSchemaBuilder(JsonSchemaResolver resolver)
 {
     _stack = new List<JsonSchema>();
     _documentSchemas = new Dictionary<string, JsonSchema>();
     _resolver = resolver;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Writes this schema to a <see cref="JsonWriter"/> using the specified <see cref="JsonSchemaResolver"/>.
 /// </summary>
 /// <param name="writer">A <see cref="JsonWriter"/> into which this method will write.</param>
 /// <param name="resolver">The resolver used.</param>
 public void WriteTo(JsonWriter writer, JsonSchemaResolver resolver)
 {
     ValidationUtils.ArgumentNotNull(writer, "writer");
     ValidationUtils.ArgumentNotNull(resolver, "resolver");
     var schemaWriter = new JsonSchemaWriter(writer, resolver);
     schemaWriter.WriteSchema(this);
 }
Ejemplo n.º 3
0
 public JsonSchemaBuilder(JsonSchemaResolver resolver)
 {
     _stack           = new List <JsonSchema>();
     _documentSchemas = new Dictionary <string, JsonSchema>();
     _resolver        = resolver;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Parses the specified json.
 /// </summary>
 /// <param name="json">The json.</param>
 /// <param name="resolver">The resolver.</param>
 /// <returns>A <see cref="JsonSchema"/> populated from the string that contains JSON.</returns>
 public static JsonSchema Parse(string json, JsonSchemaResolver resolver)
 {
     ValidationUtils.ArgumentNotNull(json, "json");
     using (JsonReader reader = new JsonTextReader(new StringReader(json)))
         return Read(reader, resolver);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Reads a <see cref="JsonSchema"/> from the specified <see cref="JsonReader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="JsonReader"/> containing the JSON Schema to read.</param>
 /// <param name="resolver">The <see cref="JsonSchemaResolver"/> to use when resolving schema references.</param>
 /// <returns>The <see cref="JsonSchema"/> object representing the JSON Schema.</returns>
 public static JsonSchema Read(JsonReader reader, JsonSchemaResolver resolver)
 {
     ValidationUtils.ArgumentNotNull(reader, "reader");
     ValidationUtils.ArgumentNotNull(resolver, "resolver");
     var builder = new JsonSchemaBuilder(resolver);
     return builder.Read(reader);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Parses the specified json.
 /// </summary>
 /// <param name="json">The json.</param>
 /// <param name="resolver">The resolver.</param>
 /// <returns>A <see cref="JsonSchema"/> populated from the string that contains JSON.</returns>
 public static JsonSchema Parse(string json, JsonSchemaResolver resolver)
 {
     ValidationUtils.ArgumentNotNull(json, "json");
     using (JsonReader reader = new JsonTextReader(new StringReader(json)))
         return(Read(reader, resolver));
 }
Ejemplo n.º 7
0
 public JsonSchemaWriter(JsonWriter writer, JsonSchemaResolver resolver)
 {
     ValidationUtils.ArgumentNotNull(writer, "writer");
     _writer   = writer;
     _resolver = resolver;
 }
Ejemplo n.º 8
0
 public JsonSchemaWriter(JsonWriter writer, JsonSchemaResolver resolver)
 {
     ValidationUtils.ArgumentNotNull(writer, "writer");
     _writer = writer;
     _resolver = resolver;
 }