You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenApiYamlReader.Read inconsistent behavior for errors #3056
Describe the bug OpenApiYamlReader.Read throws and exception in some error cases and returns a ReadResult in others. I expect it to always return a ReadResult. A ReadResult is already something that can describe a failure.
System.InvalidOperationException : No documents found in the YAML stream.
at Microsoft.OpenApi.YamlReader.OpenApiYamlReader.LoadJsonNodesFromYamlDocument(TextReader input)
at Microsoft.OpenApi.YamlReader.OpenApiYamlReader.Read(MemoryStream input, Uri location, OpenApiReaderSettings settings)
I expected it it return a ReadResult describing the error.
OpenApi File To Reproduce
An empty file.
Expected behavior
It returns a ReadResult with Document = null and a Diagnostic describing the problem.
Alternatively, when the choice between throwing an exception or returning a ReadResult is by design, this should be documented.
Activity
baywet commentedon Sep 11, 2026
Hi Joost Verhoog (@joostverhoog)
Thank you for using the SDK and for reaching out.
I've had copilot put this PR together to address this. #3078
Let me know if you have any additional comments or questions.