Open
Description
Describe the bug
Using remove-unused-components decorator leave some schemas unused by operations but that are recursive.
To Reproduce
Steps to reproduce the behavior:
- Given this
redocly.yaml
file
decorators:
remove-unused-components:
type: remove-unused-components
apis:
test:
root: test.json
- And this OpenAPI file(s)
{
"openapi": "3.1.0",
"components": {
"schemas": {
"iwontbedrop": {
"properties": {
"Myprop": {
"items": {
"anyOf": [
{
"$ref": "#/components/schemas/iwontbedrop"
}
]
},
"type": "array"
}
},
"type": "object"
},
"iwillbedrop": {
"properties": {
"name": {
"title": "Name",
"type": "string"
}
},
"type": "object"
}
}
}
}
- Run this command
redocly bundle
Expected behavior
The schema iwontbedrop
being recursive is not drop even if not used outside of it's scope. So the expectation would be to have both iwontbedrop
and iwillbedrop
to be dropped
Logs
bundling .../test.json...
openapi: 3.1.0
components:
schemas:
iwontbedrop:
properties:
Myprop:
items:
anyOf:
- $ref: '#/components/schemas/iwontbedrop'
type: array
type: object
📦 Created a bundle for .../test.json at stdout 13ms.
🧹 Removed 1 unused components.
OpenAPI description
Using version 3.1
Redocly Version(s)
1.25.8
Node.js
Version(s)
22.4.0
OS, environment
MacOS Sonoma + Ubuntu
Activity