OpenApiYamlReader.Read inconsistent behavior for errors
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
For instance, given an empty document:
using var stream = new MemoryStream();
new OpenApiYamlReader().Read(stream, new Uri("https://example.com/"), new OpenApiReaderSettings());
It throws:
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.
- Ngôn ngữ chính
- C#
- Star
- 1.6k
- Fork
- 286
- Merge trung bình
- 6 giờ 38 phút
- Pull request đã merge (30 ngày)
- 35
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/OpenAPI.NET
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/OpenAPI.NET#2798 ·
-
type:breaking-change
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
microsoft/OpenAPI.NET#3014 · 2 bình luận ·
-
Implement equality (`IEquatable<T>` and override object.Equals/GetHashCode) for object models Đang mởhelp wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/OpenAPI.NET#2989 · 3 bình luận ·
-
help wanted type:feature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
microsoft/OpenAPI.NET#2967 · 18 bình luận · 1 reaction ·
-
help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/OpenAPI.NET#2963 · 5 bình luận ·
Tất cả issue của microsoft/OpenAPI.NET
Issue tương tự
-
Status: Waiting triage Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
nanoframework/Home#1857 ·
-
kind/bug kind/regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
unoplatform/uno.toolkit.ui#1646 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nightscout/nocturne#1379 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
elastic/esql-dotnet#47 ·
-
port: add go-steam fork Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100