Skip to content

fix: Rewrite nested whole document external refs to components (#1889) - #2385

Open
ewaostrowska wants to merge 1 commit into
masterfrom
issue-1889
Open

fix: Rewrite nested whole document external refs to components (#1889)#2385
ewaostrowska wants to merge 1 commit into
masterfrom
issue-1889

Conversation

@ewaostrowska

@ewaostrowska ewaostrowska commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

When an external file referenced by an OAS document contains its own refs that point to other files as whole-document references (no # fragment), the parser resolved the file path but never rewrote the $ref to an internal component form. The resolved output kept raw file paths like ../common/models/Product.yaml instead of #/components/schemas/Product, making the resolved spec unusable for code generators and other consumers.

Before: items.$ref stayed as an absolute file path

items:
  $ref: /abs/path/to/common/models/Product.yaml 

After: items.$ref is rewritten to an internal ref

items:
  $ref: '#/components/schemas/Product'

The same bug affected headers, links, and examples .

Fragment refs (file.yaml#/components/schemas/X) were already handled correctly by the existing code and are not affected by this change.

Fixes: #1889

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reference resolution fails in openapi-diff for schema reference for array items

1 participant