Skip to content

Commit a9048c1

Browse files
Update src/Microsoft.OpenApi/Validations/Rules/JsonSchemaRules.cs
Co-authored-by: Vincent Biret <[email protected]>
1 parent d6a6b53 commit a9048c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public static class JsonSchemaRules
3939

4040
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());
4546
RuleHelpers.ValidateDataTypeMismatch(context, nameof(SchemaMismatchedDataType), jsonSchema.GetExamples().ElementAt(i), jsonSchema);

0 commit comments

Comments
 (0)