Redocly / Redocly/redocly-cli

Remove unused components in bundle removes array item references

Open
#1,012 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p2 Type: Bug
Dominant language
TypeScript
Stars
1.5k
Forks
228
Avg merge
1d 14h
Merged PRs (30d)
48

Description

Any scheme used via

type: array
items:
  $ref: some-reference

will be removed if --remove-unused-components flag is used in the redocly bundle command.
Same spec with workaround

type: array
items:
  allOf:
    -$ref: some-reference

will not suffer from this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with redocly bundle --remove-unused-components using an array whose items contain a direct $ref, then compare it with the allOf workaround shown in the report. Trace the bundle component-removal path; done means direct array item references remain in the bundled output while genuinely unused components are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.