OpenApiStringReader bubbles parsing error for valid JSON document
The following document produces a parsing error due to the backslash in the basePath property. It is valid JSON, however, so I feel like the library should handle this without error. I believe this is a limitation/bug in SharpYaml parser being used within OpenAPI.NET.
Document
{
"swagger": "2.0",
"info": {
"title": "This is a simple example",
"version": "1.0.0"
},
"host": "example.org",
"basePath": "\/api",
"schemes": [
"http",
"https"
],
"paths": {}
}
Repro Code
var openApiStringReader = new OpenApiStringReader();
OpenApiDocument openApiDocument = openApiStringReader.Read( serializedDocument, out OpenApiDiagnostic openApiDiagnostic );
Error from OpenApiDiagnostic (Lin: 7, Col: 13, Chr: 140) - (Lin: 7, Col: 14, Chr: 141): While parsing a quoted scalar, find unknown escape character.
This is a new escape character in Yaml 1.2. I will create a PR in SharpYaml to add support for it.
We should retest this bug to see if latest versions of YamlSharp address this. /cc @MaggieKimani1