Skip to content

Commit

Permalink
Merge pull request #1856 from microsoft/mk/make-update-validation-rule
Browse files Browse the repository at this point in the history
Remove validation rule to make paths and webhooks optional
  • Loading branch information
MaggieKimani1 authored Oct 8, 2024
2 parents 4e50523 + 1941a57 commit 23fde05
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/Microsoft.OpenApi/Reader/ParsingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,6 @@ private void ValidateRequiredFields(OpenApiDocument doc, string version)
// paths is a required field in OpenAPI 3.0 but optional in 3.1
RootNode.Context.Diagnostic.Errors.Add(new OpenApiError("", $"Paths is a REQUIRED field at {RootNode.Context.GetLocation()}"));
}
else if (version.is3_1() && (doc.Paths == null || !doc.Paths.Any()) && (doc.Webhooks == null || !doc.Webhooks.Any()))
{
RootNode.Context.Diagnostic.Errors.Add(new OpenApiError(
"", $"The document MUST contain either a Paths or Webhooks field at {RootNode.Context.GetLocation()}"));
}
}
}
}

0 comments on commit 23fde05

Please sign in to comment.