The OpenAPI.NET SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model.
I would like to see documentation of the possible syntaxes here. I have an MSBuild task that tries to parse this string and pass line and column numbers to TaskLoggingHelper.LogError.
Currently, the possibilities seem to be:
#line= + line number counting from 0. This is defined in [RFC 5147](https://tools.ietf.org/html/rfc5147 "Wilde, E. and M. Duerst, \"URI Fragment Identifiers for the text/plain Media Type\", RFC 5147, DOI 10.17487/RFC5147, April 2008, https://www.rfc-editor.org/info/rfc5147."), although that does not formally apply to application/json.
# + JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901 "Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., \"JavaScript Object Notation (JSON) Pointer\", RFC 6901, DOI 10.17487/RFC6901, April 2013, https://www.rfc-editor.org/info/rfc6901.")), except the ~ and / characters are not escaped as ~0 and ~1.
Verified that OpenApiError.Pointer in Microsoft.OpenApi.Readers 1.2.2 does not escape / as ~1 if the error occurs within a Path Item Object, whose key in the Paths Object always starts with a slash.
The OpenApiError.Pointer property currently has a minimal XML documentation comment:
https://github.com/microsoft/OpenAPI.NET/blob/be6a700805710a86fcb73bbcbffaec6f571ba4b9/src/Microsoft.OpenApi/Models/OpenApiError.cs#L34-L37
I would like to see documentation of the possible syntaxes here. I have an MSBuild task that tries to parse this string and pass line and column numbers to TaskLoggingHelper.LogError.
Currently, the possibilities seem to be:
#line=
+ line number counting from 0. This is defined in [RFC 5147](https://tools.ietf.org/html/rfc5147 "Wilde, E. and M. Duerst, \"URI Fragment Identifiers for the text/plain Media Type\", RFC 5147, DOI 10.17487/RFC5147, April 2008, https://www.rfc-editor.org/info/rfc5147."), although that does not formally apply to application/json.#char=
+ line number counting from 0. Will be fixed in https://github.com/microsoft/OpenAPI.NET/issues/495.#
+ JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901 "Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., \"JavaScript Object Notation (JSON) Pointer\", RFC 6901, DOI 10.17487/RFC6901, April 2013, https://www.rfc-editor.org/info/rfc6901.")), except the~
and/
characters are not escaped as~0
and~1
.(Some errors have more detailed location information in OpenApiError.Message. Filed https://github.com/microsoft/OpenAPI.NET/issues/502 for making that easier to access.)