-
Notifications
You must be signed in to change notification settings - Fork 227
Add pathItem reference resolution for OpenAPI 3.1 specs #891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
| _.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" |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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"
},
}
Description
Add pathItem reference resolution for OpenAPI 3.1 specs
When bundling multifile OpenAPI 3.1 specifications, the bundler correctly creates
$refpointers in thepathsobject that referencecomponents.pathItems(which is valid in OpenAPI 3.1). However,convertV2()andconvertV2WithTypes()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