openapi3-parser icon indicating copy to clipboard operation
openapi3-parser copied to clipboard

[BUG] Resolver doesnt handle %7B -> { or %7D -> }

Open dicolanl opened this issue 6 months ago • 2 comments

Describe the bug Openapi supports $ref to another file. when there is a path you need to encode / as ~1. {} needs to be %7B and %7D.

openapi_parser.errors.ParserError: OpenAPI file parsing error: Cannot resolve reference "file:///path/openapi-split/openapi-audit.yaml#/paths/~1audit~1export~1csv~1%7BexportId%7D": 'Object at "/paths" does not contain key: /audit/export/csv/%7BexportId%7D'

To Reproduce Steps to reproduce the behavior:

  1. use a $ref for a path with {} encoded.
  2. use content = parse("/path/openapi.yaml")
  3. See error

Expected behavior The parser should support the encoded paths and translate them when resolving the $ref.

System details (please complete the following information):

  • OS: MAC 15.5
  • OpenAPI / Swagger version 3.0.1
  • Python version Python 3.11.1

dicolanl avatar May 28 '25 18:05 dicolanl

Hey @dicolanl! This parser uses prance behind the scenes to resolve $ref usage. Could you please check if the latest version works for your case?

manchenkoff avatar May 31 '25 16:05 manchenkoff

Ill try. traveling and quick try couldnt get prance installed or running...

dicolanl avatar Jun 02 '25 13:06 dicolanl