public void Example()
        {
            #region Usage
            JsonSchema schema = new JsonSchema
            {
                Type = JsonSchemaType.Object
            };

            // serialize JsonSchema to a string and then write string to a file
            File.WriteAllText(@"c:\schema.json", schema.ToString());

            // serialize JsonSchema directly to a file
            using (StreamWriter file = File.CreateText(@"c:\schema.json"))
            using (JsonTextWriter writer = new JsonTextWriter(file))
            {
                schema.WriteTo(writer);
            }
            #endregion
        }
        public void WriteTo_PositionalItemsValidation_FalseWithItemsSchema()
        {
            JsonSchema schema = new JsonSchema();
            schema.Items = new List<JsonSchema> { new JsonSchema { Type = JsonSchemaType.String } };

            StringWriter writer = new StringWriter();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);
            jsonWriter.Formatting = Formatting.Indented;

            schema.WriteTo(jsonWriter);

            string json = writer.ToString();

            StringAssert.Equal(@"{
  ""items"": {
    ""type"": ""string""
  }
}", json);
        }
        public void WriteTo_PatternProperties()
        {
            JsonSchema schema = new JsonSchema();
            schema.PatternProperties = new Dictionary<string, JsonSchema>
            {
                { "[abc]", new JsonSchema() }
            };

            StringWriter writer = new StringWriter();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);
            jsonWriter.Formatting = Formatting.Indented;

            schema.WriteTo(jsonWriter);

            string json = writer.ToString();

            StringAssert.Equal(@"{
  ""patternProperties"": {
    ""[abc]"": {}
  }
}", json);
        }
        public void WriteTo_PositionalItemsValidation_True()
        {
            JsonSchema schema = new JsonSchema();
            schema.PositionalItemsValidation = true;

            StringWriter writer = new StringWriter();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);
            jsonWriter.Formatting = Formatting.Indented;

            schema.WriteTo(jsonWriter);

            string json = writer.ToString();

            StringAssert.Equal(@"{
  ""items"": []
}", json);
        }
        public void WriteTo_ExclusiveMinimum_ExclusiveMaximum()
        {
            JsonSchema schema = new JsonSchema();
            schema.ExclusiveMinimum = true;
            schema.ExclusiveMaximum = true;

            StringWriter writer = new StringWriter();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);
            jsonWriter.Formatting = Formatting.Indented;

            schema.WriteTo(jsonWriter);

            string json = writer.ToString();

            StringAssert.Equal(@"{
  ""exclusiveMinimum"": true,
  ""exclusiveMaximum"": true
}", json);
        }