Skip to content

Copy the line number to OpenApiError.Pointer if known #502

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

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.

throw new OpenApiException(
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");

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

No one assigned

    Labels

    goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorstype:enhancementEnhancement request targeting an existing experience

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions