-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Overzealous dereferencing in bundle call #182
Labels
Comments
Option 1: Point directly to type: object
properties:
username:
...
firstName:
...
lastName:
...
email:
$ref: Email.yaml # <--- Pointing to Email.yaml in the same folder as User.yaml Option 2: Point to the type: object
properties:
username:
...
firstName:
...
lastName:
...
email:
$ref: "../../openapi.yaml#/components/schemas/Email" |
No response in a long time and seems to be working as intended. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm working on some code to add Redoc static docs for OpenAPI specifications. I'm hoping to support a repo structure where sections of the API spec (paths, components, tags, etc.) can be kept and tracked in separate files, but merged into a single file and rendered for user-facing docs. The @redocly/openapi-cli library includes a
bundle
module, but it doesn't enable any control over resolving/dereferencing (cc @RomanHotsiy, Redoc maintainer and contributor to this code base... in case I'm missing or misrepresenting anything from his stack).Alternatively, I've tried to use the
$RefParser.bundle()
functionality in this library to bundle API.yaml
s into a single file. However, I'm still not seeing the behavior I'm looking for: inserting referenced local files to the main doc, without any additional/recursive dereferencing.In the YAML schema file (
<rootDir>/openapi.yaml
) I'm referencing with$RefParser.bundle(...)
, I have the following$ref
s, which point to local files:The schema in
<rootDir>/components/schemas/User.yaml
looks like this:Based on the description of the
bundle()
method, I would expect thecomponents/schemas/Users
section of the output to look like this:... where the
User
schema is basically inserted as-is.Instead, I get the following error message:
... which suggests to me that the parser is also attempting to resolve/dereference
$ref
s in<rootDir>/components/schemas/User.yaml
(contrary to the behavior I'm expecting).I feel like what I'm missing is some sort of
depth
argument to constrain which$ref
s get resolved/dereferenced — e.g., only those in the primary spec. It's entirely possible I'm just overlooking something in the docs, but I'm currently stumped. Any tips or direction would be greatly appreciated.The text was updated successfully, but these errors were encountered: