fix swagger validation test

This commit is contained in:
Kukks 2020-03-20 17:37:39 +01:00
parent f8f358ebdb
commit 98a48cd0a5

View file

@ -102,6 +102,13 @@ namespace BTCPayServer.Tests
var schema = JSchema.Parse(await resp.Content.ReadAsStringAsync());
IList<ValidationError> errors;
bool valid = swagger.IsValid(schema, out errors);
//the schema is not fully compliant to the spec. We ARE allowed to have multiple security schemas.
if (!valid && errors.Count == 1 && errors.Any(error =>
error.Path == "components.securitySchemes.Basic" && error.ErrorType == ErrorType.OneOf))
{
errors = new List<ValidationError>();
valid = true;
}
Assert.Empty(errors);
Assert.True(valid);
}