Open amine-mf opened 3 months ago
Thanks for reporting! BTW, does dereferenced bundling work around your issue?
Thanks for the quick reply. --dereferenced
does workaround the issue, but still not the best option as some of the APIs we handle may contain "cycles", we usually dereference "lazily" to avoid infinite loops. Also the size of the API might get too bigger.
Yes, I think that makes sense.
Describe the bug When a file references itself, the references are not substituted with local refs.
To Reproduce Steps to reproduce the behavior:
redocly bundle test-api.json -o test-api-bundled.json
"$ref": "test-api.json#/parameters/myParam"
Expected behavior
"$ref": "test-api.json#/parameters/myParam"
should be replaced by"$ref": "#/parameters/myParam"
.Logs
OpenAPI description Faced with Microsoft-Azure swagger specifications but for simplicity, linked a minimal example to showcase the issue. Haven't tested yet with OpenAPI V3, but expected the same behavior.
Redocly Version(s) 1.16.0
Node.js
Version(s) 18.18.2Additional context Clearly, the Swagger could be written differently and also, we could patch it, but still, after a bundle, if successful, you would expected no more external reference format in any reference. By the way, issue was noticed first when using
@redocly/openapi-core
but reproduced with the CLI.