Redocly / Redocly/redoc

Bundle doesn't correctly resolve components before processing paths

Open
#2,750 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

Describe the bug
I have a multi-file spec, where paths and operations are included as $refs. Whenever I bundle, any operation $ref to #components/schemas/SchemaName gives a bundler error of "Can't resolve $ref", even though that schema is defined in the root components.schema object. If I --force the bundling, linting the output verifies that all refs are in fact valid, so it's just the bundler that is confused.

Expected behavior
References to components.schemas should be properly resolved.

I'd also like to dynamically populate components.schemas with a NamedSchemas decorator, so ideally the entire components tree would be processed before paths in order to resolve refs properly.

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

Start by reproducing the multi-file spec described in the issue, with paths and operations as $refs and a root components.schemas entry. Trace the bundler's processing order for components and paths; done means component references resolve without --force and the bundled output passes linting.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
backend-api-design, tooling
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.