-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing error when path key exceeds 1023 characters #786
Comments
Thanks for reporting this. It might be a limitation with the SharpYaml parser. I'm not aware of any limitation with the OpenAPI object model itself, although I don't think we have ever tried a path that long. |
Hi @darrelmiller , thanks for the reply. You are right, it is a limitation in SharpYaml. I'm wondering if there is a way to have OpenAPI.NET request from SharpYaml that the limit be higher, either by default or via some configuration mechanism (perhaps where the consumer of OpenAPI.NET would set the limit and have it get passed through to SharpYaml). For us, this issue is a big concern, this is not just a speculative use case. We have real world customers generating OA3 json documents that have keys in the Paths Object that exceed the current limit. Since such keys result in fatal SemanticErrorExceptions from SharpYaml, this means that when such path is present, we don't get any useful Paths information in the resultant OpenApiDocument instance, and we are unable to proceed. |
@ShaunLoganOracle Question for you. If we were to update the JSON parsing to use System.Text.Json for faster parsing and if System.Text.Json does not have this limitation, would this be an sufficient workaround for this issue? |
@darrelmiller |
Work ongoing in #841 |
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: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:
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
The text was updated successfully, but these errors were encountered: