OpenAPI.NET
OpenAPI.NET copied to clipboard
Investigate how to skip validation of unresolved reference schema
This test has been removed in v2. We need to investigate how to properly check for unresolve JSON Schema refs and skip validation.
public void UnresolvedReferenceSchemaShouldNotBeValidated()
{
// Arrange
var sharedSchema = new JsonSchemaBuilder().Type(SchemaValueType.String).Ref("test").Build();
OpenApiDocument document = new OpenApiDocument();
document.Components = new OpenApiComponents()
{
Schemas = new Dictionary<string, JsonSchema>()
{
["test"] = sharedSchema
}
};
// Act
var rules = new Dictionary<string, IList<ValidationRule>>()
{
{ typeof(JsonSchema).Name,
new List<ValidationRule>() { new AlwaysFailRule<JsonSchema>() }
}
};
var errors = document.Validate(new ValidationRuleSet(rules));
// Assert
Assert.True(!errors.Any());
}