-
-
Notifications
You must be signed in to change notification settings - Fork 528
Fix remote schema maps #1212
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
Fix remote schema maps #1212
Conversation
🦋 Changeset detectedLatest commit: c25f227 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4a71732
to
39916e0
Compare
Deploying with
|
Latest commit: |
c25f227
|
Status: | ✅ Deploy successful! |
Preview URL: | https://c751f852.openapi-ts.pages.dev |
Branch Preview URL: | https://fix-remote-schema-maps.openapi-ts.pages.dev |
@@ -3965,7 +3965,160 @@ export interface external { | |||
default: external["shared/responses/unexpected_error.yml"]; | |||
}; | |||
} | |||
"resources/certificates/models/certificate_create.yml": unknown |
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.
🤔 this is probably a good sign
39916e0
to
4926934
Compare
return getHintFromSchemaObject(path.slice(2), external); // skip array index at [1] | ||
} | ||
// if this is external, and the path is [filename, key], then the external schema is probably a SchemaMap | ||
if (path.length === 2 && external) { |
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.
Very wacky logic, but it seems to check out 🤷
4926934
to
5d33b21
Compare
5d33b21
to
c25f227
Compare
Changes
Fixes #1131. There are likely some other bugs with deeply-nested remote schemas, but this fixes at least one.
The reason was in our
getHint()
logic that traverses the nodePath, it wasn’t keeping track of remote filenames, which is necessary for certain inferences (the hints are necessary because partial schemas could be anything and still be valid—the only way to know is by tracing from the root). There’s probably a better solution than this, but this will do for now.How to Review
Tests should pass.
Checklist
examples/
directory updated (only applicable for openapi-typescript)