예제 #1
0
        public async Task When_yaml_schema_has_references_it_works(string relativePath, string documentPath)
        {
            //// Arrange
            var path = GetTestDirectory() + relativePath;

            //// Act
            var schema = await JsonSchemaYaml.FromFileAsync(path);

            var json = schema.ToJson();

            //// Assert
            Assert.Equal(JsonObjectType.Integer, schema.Properties["foo"].ActualTypeSchema.Type);
            Assert.Equal(1, schema.Definitions.Count);
            Assert.Equal(documentPath, schema.Definitions["collection"].DocumentPath);
        }
 public string GetJsonSchema(string yamlSchema)
 {
     var schema = JsonSchemaYaml.FromYamlAsync(yamlSchema).GetAwaiter().GetResult();
     return schema.ToJson();
 }