Skip to content

Commit 7f14ba1

Browse files
committed
Merge branch 'mk/add-webhooks-property' into mk/add-pathItems-to-components-object
2 parents 01fefe9 + 21e19a0 commit 7f14ba1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Microsoft.OpenApi.Readers/ParsingContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ public void PopLoop(string loopid)
248248

249249
private void ValidateRequiredFields(OpenApiDocument doc, string version)
250250
{
251-
if ((version == "2.0" || version.StartsWith("3.0")) && (doc.Paths == null || doc.Paths.Any()))
251+
if ((version == "2.0" || version.StartsWith("3.0")) && (doc.Paths == null || !doc.Paths.Any()))
252252
{
253253
// paths is a required field in OpenAPI 3.0 but optional in 3.1
254254
RootNode.Context.Diagnostic.Errors.Add(new OpenApiError("", $"Paths is a REQUIRED field at {RootNode.Context.GetLocation()}"));
255255
}
256256
else if (version.StartsWith("3.1"))
257257
{
258-
if ((doc.Paths == null || doc.Paths.Count == 0) && (doc.Webhooks == null || doc.Webhooks.Any()))
258+
if ((doc.Paths == null || !doc.Paths.Any()) && (doc.Webhooks == null || !doc.Webhooks.Any()))
259259
{
260260
RootNode.Context.Diagnostic.Errors.Add(new OpenApiError(
261261
"", $"The document MUST contain either a Paths or Webhooks field at {RootNode.Context.GetLocation()}"));

0 commit comments

Comments
 (0)