Repository navigation
Closed as not planned
Labels
goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorsStandard GitHub label used for easy to resolve issues targeting beginner contributorstype:enhancementEnhancement request targeting an existing experienceEnhancement request targeting an existing experience
Milestone
Description
Some methods in Microsoft.OpenApi.Readers throw an OpenApiException whose Exception.Message includes a line number. I would like to have all of these line numbers available in OpenApiError.Pointer, to make them easier to parse automatically.
OpenAPI.NET/src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs
Lines 30 to 31 in be6a700
| throw new OpenApiException( | |
| $"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}"); |
OpenAPI.NET/src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs
Lines 50 to 51 in be6a700
| throw new OpenApiException( | |
| $"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}"); |
| throw new OpenApiException($"Expected map at line {yamlMap.Start.Line} while parsing {typeof(T).Name}"); |
| throw new OpenApiException($"Expected map at line {yamlMap.Start.Line} while parsing {typeof(T).Name}"); |
| throw new OpenApiException($"Expected map at line {yamlMap.Start.Line} while parsing {typeof(T).Name}"); |
| throw new OpenApiException($"Expected scalar at line {_node.Start.Line} for key {key.GetScalarValue()}"); |
| throw new OpenApiException($"Expected scalar at line {node.Start.Line}"); |
Metadata
Metadata
Assignees
Labels
goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorsStandard GitHub label used for easy to resolve issues targeting beginner contributorstype:enhancementEnhancement request targeting an existing experienceEnhancement request targeting an existing experience
Activity
AP-G commentedon Sep 3, 2020
This indeed would be very helpful!
In addition, it would be nice if the diagnostic object supported error levels like "Warning", "Error". This would allow a better distinction for exceptions that can be actively ignored in processing.
Furthermore, it would be very helpful if the errors were categorized or numbered. Then they could be processed more easily instead of having to parse the strings.
darrelmiller commentedon Apr 29, 2025
OpenAPI.Net now supports errors and warnings, but unfortunately System.Text.Json does not support exposing line numbers.