-
Notifications
You must be signed in to change notification settings - Fork 279
Description
Using v1.2.3 (also tried with 1.3.1-preview), I am getting a parsing error if the OA3 json has a path key that exceeds 1023 characters. For example, take the PetStore reference OA3 json and change the /pets path key to be extremely long. Attempt to read/parse the file, and get a parsing error:
Message: (Lin: 15, Col: 1032, Chr: 1302) - (Lin: 15, Col: 1033, Chr: 1303): While parsing a flow mapping, did not find expected ',' or '}'.
Pointer: #line=15
Is this a known limitation? I don't see anything in the OA3 spec about a limit on key sizes. Is there any workaround?
Yes, the key seems excessively long, but it is generated by a customer's application which my product does not control.
Edit: Also, the error is fatal in that no other path entries get parsed - the Paths property on the oaDoc is empty.
Sample Code:
var filepath = @"c:\temp\petstore-3.0-with-a-really-long-path.json";
OpenApiStreamReader reader = new OpenApiStreamReader ();
using (Stream file = new FileStream (filepath, FileMode.Open))
{
var oaDoc = reader.Read (file, out OpenApiDiagnostic diags);
// expected: json to be parsed successfully
// observed: error found
if (diags.Errors.Count > 0)
{
var error = diags.Errors.First ();
Console.WriteLine ($"Found error(s), msg: {error.Message} ptr: {error.Pointer}");
}
}
Sample (long) Key:
/pets-with-a-really-long-path-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123