Removes unused components from the bundle output.
In this context, "used" means that a component defined in the
components object is referenced elsewhere in the API document with
This decorator is intended to help security-focused enterprises prevent data leaks. Components can leak schemas, parameters, and other properties that may be unused in the exposed APIs, but used internally elsewhere.
However, your API document may contain common components used in other APIs. If that describes your use-case, please avoid using this decorator.
Example of a configuration:
decorators: remove-unused-components: on
Read the article on no-unused-components rule to see examples.
The Redocly CLI
bundlecommand supports an option called
--remove-unused-components. Use it to automatically clean up any unused components from your OpenAPI document while bundling it.
- Components docs