Skip to content

Commit

Permalink
Remove validation rule to make paths and webhooks optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieKimani1 committed Oct 3, 2024
1 parent 7261ad9 commit 1941a57
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 1941a57

Please sign in to comment.