Redocly / Redocly/redocly-cli

Prevent `redocly bundle` from creating new schema objects in `#/components/schemas` when using `--dereferenced` option

Open
#1,798 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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:

  1. Given this redocly.yaml file
  2. And these OpenAPI files
  3. Run npx redocly bundle schema/openapi.json --dereferenced -o out/openapi.json
  4. See that PropertyValuePair and Error schema objects are added to #/components/schemas in the bundled OpenAPI document

Expected 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 and v20.12.2

OS, environment

Kubuntu 22.04

Additional context

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 schema/openapi.json, schema/schemas.json, redocly.yaml, and npx redocly bundle ... --dereferenced. Start at the bundle command's dereferencing and schema-component handling, then verify that only the expected schemas remain in the bundled OpenAPI document.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, openapi, typescript
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.