-
Notifications
You must be signed in to change notification settings - Fork 154
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
Prevent redocly bundle
from creating new schema objects in #/components/schemas
when using --dereferenced
option
#1798
Comments
Have you tried using the |
I have. It removes some, but not all, of the components. In this example, I also don't want to remove all the components. I would like to keep |
Ah, so you want to bundle your files, preserve the existing components, and not add the new ones? Then it's more of an enhancement rather than a bug. I'm not sure it would be an easy change. It will require modifying the internals, as the bundler currently resolves external references into the const filterSchemas = () => {
let originalSchemas;
return {
Components: {
leave(components) {
for (const key in components.schemas || {}) {
if (originalSchemas?.[key] === undefined) {
delete components.schemas[key];
}
}
},
NamedSchemas: {
enter(schemas) {
originalSchemas = schemas;
},
},
},
};
}; Please let me know if that works! |
Ideally, we would like to bundle the files and only dereference/inline schemas that aren't already in Thanks for the custom decorator plugin code, we will try it out. |
Describe the bug
The
redocly bundle
command is adding schema objects to the#/components/schemas
section of the bundled schema, even when using the--dereferenced
option is used.Closed issue #239 seems to be similar and points to using the
--dereferenced
option to solve this issue.To Reproduce
Steps to reproduce the behavior:
redocly.yaml
filenpx redocly bundle schema/openapi.json --dereferenced -o out/openapi.json
PropertyValuePair
andError
schema objects are added to#/components/schemas
in the bundled OpenAPI documentExpected behavior
I would expect only (dereferenced versions of) the schema objects present in
schemas.json
to be in the#/components/schemas
section of the bundled and dereference OpenAPI document.Logs
OpenAPI description
OpenAPI v3.1 - see example repo
Redocly Version(s)
"@redocly/cli": "^1.25.11",
Node.js Version(s)
v18.20.4
andv20.12.2
OS, environment
Kubuntu 22.04
Additional context
The text was updated successfully, but these errors were encountered: