fix: preserve external $ref URLs instead of converting to local refs#11
Open
remorses wants to merge 2 commits intostandard-community:mainfrom
Open
fix: preserve external $ref URLs instead of converting to local refs#11remorses wants to merge 2 commits intostandard-community:mainfrom
remorses wants to merge 2 commits intostandard-community:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the handling of external $ref URLs in schema conversions. Previously, all $ref values were converted to local OpenAPI component references (#/components/schemas/...), but now external URLs (http/https) are preserved as-is.
Changes:
- Modified
convertToOpenAPISchemato detect and preserve external$refURLs instead of converting them to local component references - Added test case for external
$refURL preservation with Zod v4 - Updated snapshot to reflect the new behavior where external URLs are kept intact
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vendors/convert.ts | Added logic to detect http/https URLs in $ref and preserve them instead of converting to local component refs |
| tests/zod_v4.test.ts | Added test case verifying external $ref URLs are preserved |
| tests/snapshots/zod_v4.test.ts.snap | Snapshot showing external URL is preserved alongside original schema properties |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
External
$refURLs (http/https) are now preserved as-is instead of being converted to local#/components/schemas/references.This allows schemas to reference external JSON Schema definitions for editor autocomplete while keeping the OpenAPI spec valid.
Example:
$ref: "https://models.dev/model-schema.json#/$defs/Model"is now preserved instead of being converted to$ref: "#/components/schemas/Model".cc @MathurAditya724
Blocked PR: anomalyco/opencode#12112