Skip to content

Investigate how to skip validation of unresolved reference schema #1436

@irvinesunday

Description

@irvinesunday

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());
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions