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
remove-unused-components skips schemas that have a top-level allOf
#1209
Comments
@slavikbez I think this came from your PR (#443). I'd be interested in hearing your feedback on this. |
@jedelson-pagerduty I believe those changes mirror this rule:
Looks like this is a workaround to detect discriminators. |
@tatomyr thanks for that pointer, although that leaves me with more questions :) But those probably aren't important.
I think the problematic scenario is something like this:
Which makes more sense as a problematic case than what I was originally thinking. I'll update my PR to address this. |
I haven't found any related tests that can shed some light on what was the case for this 😄. |
Yes, as @jedelson-pagerduty noted in the updated comment, the problem is related to implicit discriminator mapping. Someone can point to |
Describe the bug
Given an OpenAPI document that contains something along these lines:
It would be expected that bundle --remove-unused-components would remove the Unused schema since it isn't used.
However, the current behavior is that after running bundle with --removed-unused-components, Unused is not removed. This appears to be intentional (see
redocly-cli/packages/core/src/rules/oas3/remove-unused-components.ts
Line 64 in cfa3133
To Reproduce
Steps to reproduce the behavior:
Expected behavior
An unused component gets removed regardless of whether it has an
allOf
or not.OpenAPI definition
Have only tested with 3.0 but the same
if
statement is present in theoas2
rule.Redocly Version(s)
1.0.0 and main.
Node.js
Version(s)16.17.0, 16.18.0, and 18.16.0
The text was updated successfully, but these errors were encountered: