Skip to content

Commit d190669

Browse files
committed
Merge branch 'mk/fix-bugs-and-failing-tests' of https://github.com/microsoft/OpenAPI.NET into mk/fix-bugs-and-failing-tests
2 parents 60d6993 + cb8288b commit d190669

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Microsoft.OpenApi/Validations/Rules/JsonSchemaRules.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ public static class JsonSchemaRules
3737
// examples
3838
context.Enter("examples");
3939

40-
if (jsonSchema.GetExamples() != null)
40+
if (jsonSchema.GetExamples() is { } examples)
4141
{
42-
for (int i = 0; i < jsonSchema.GetExamples().Count(); i++)
42+
var examplesCount = examples.Count();
43+
for (int i = 0; i < examplesCount; i++)
4344
{
4445
context.Enter(i.ToString());
45-
RuleHelpers.ValidateDataTypeMismatch(context, nameof(SchemaMismatchedDataType), jsonSchema.GetExamples().ElementAt(i), jsonSchema);
46+
RuleHelpers.ValidateDataTypeMismatch(context, nameof(SchemaMismatchedDataType), examples.ElementAt(i), jsonSchema);
4647
context.Exit();
4748
}
4849

0 commit comments

Comments
 (0)