Skip to content

Conversation

@animeshjajoopostman
Copy link
Collaborator

@animeshjajoopostman animeshjajoopostman commented Oct 18, 2025

Description

Add pathItem reference resolution for OpenAPI 3.1 specs

When bundling multifile OpenAPI 3.1 specifications, the bundler correctly creates $ref pointers in the paths object that reference components.pathItems (which is valid in OpenAPI 3.1). However, convertV2() and convertV2WithTypes() expect path operations to be inline, not referenced. This resulted in empty collections with folders but no actual requests.

Testing Videos

Before

https://www.loom.com/share/560803f154af4b43884e1ad06e6d64c4?sid=49488c91-6513-484d-bf77-3c94eb9a174c

AFTER

https://www.loom.com/share/0aa0e641302141d594f39b83509b55fe?sid=0afb4781-4918-46b7-b10c-a399726b462f

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2025

unit test code coverage

Lines Statements Branches Functions
Coverage: 89%
89.22% (5824/6527) 80.88% (3825/4729) 93.79% (862/919)
Coverage Breakdown • (89%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files89.2280.8893.7989.34 
report-only-changed-files is enabled. No files were changed in this commit :)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2025

integration test code coverage

Lines Statements Branches Functions
Coverage: 19%
19.26% (2048/10632) 13.46% (1002/7441) 19.91% (236/1185)
Coverage Breakdown • (19%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files19.2613.4619.9119.54 
report-only-changed-files is enabled. No files were changed in this commit :)

@animeshjajoopostman animeshjajoopostman requested review from AyushShri, barshan23 and Copilot and removed request for Copilot October 23, 2025 06:40
_.forEach(spec.paths, (pathValue, pathKey) => {
// Check if this path is a $ref to a pathItem
if (pathValue && pathValue.$ref && typeof pathValue.$ref === 'string') {
// Match patterns like "#/components/pathItems/paths_pets.yaml"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a requirement ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you're asking this for the typeof check.

Type checking for string refs ensures valid spec references are being used. Instead of throwing an error, I'm ignoring that path reference.

Also .match() on line 391 will throw an error if the ref is not a string.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I meant about this match pattern itself ? Can you share the documentation link that mentions that the $refs needs to follow the pattern ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OAS 3.1 Components: https://spec.openapis.org/oas/v3.1.0.html#components-object

$refs are defined similar to other versions, but generateObjectName() adds the file extension while bundling.

"referenceMap": {
    "#/components/pathItems/paths_pets.yaml": {
        "path": "paths/pets.yaml",
        "type": "component"
    },
}
Screenshot 2025-10-23 at 3 04 42 PM

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.

2 participants