Skip to content
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

Add option to keep $refs (don't dereference $refs) #11

Open
outdooracorn opened this issue Nov 10, 2022 · 1 comment
Open

Add option to keep $refs (don't dereference $refs) #11

outdooracorn opened this issue Nov 10, 2022 · 1 comment
Labels
invalid This doesn't seem right

Comments

@outdooracorn
Copy link

Thanks for creating this tool, it looks really useful.

It would be great to have an option that doesn't dereference $refs. There are some references, like ones that point to schemas in #/components/schemas, that I would like to keep in the single bundled/processed file.

The $refs should still be updated when multiple files are merged/bundled into one though.
E.g. "$ref": "../../global/schemas.json#/ExampleSchema" should become "$ref": "#/components/schemas/ExampleSchema".

@dolmen
Copy link
Member

dolmen commented Dec 4, 2024

This is already supported from day 0. However, there is a design constraint (mentioned in README) for your included document: the $ref must use an absolute JSON pointer (the part after # must start with /) and the referenced resources must be put in a place that follows the standard Open API layout for storing components.

So for a concrete answer to this question, you have to restructure the file schemas.json to put ExampleSchema under /components/schemas instead of at root. Then your $ref will point to ../../global/schemas.json#/components/schemas/ExampleSchema

@dolmen dolmen added the invalid This doesn't seem right label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants