Conversation
| // If base is explicitly set, use it as-is | ||
| // Preserve remote bases so they can configure remote reference resolution. | ||
| if baseFlag != "" { | ||
| if strings.Contains(baseFlag, "://") { |
There was a problem hiding this comment.
[P2] Preserve remote bases for JSON Schema stdin too
This helper fixes the file-based lint/report paths, but collectSchemaInputs still bypasses it for stdin and unconditionally runs filepath.Abs(baseFlag). That leaves both vacuum schema lint --stdin --base https://… and vacuum schema bundle --stdin --base https://… treating the URL as a local directory. On this head, the bundle path attempted to open /private/tmp/.../http:/127.0.0.1:18765/defs.json, and no request reached the HTTP server.
Please route the stdin base through this helper (or a shared base normalizer) and add regression coverage for schema lint and bundle stdin modes.
|
Review summary The core file-based fix works as intended. I verified the exact PR head ( One P2 remains inline: JSON Schema stdin still sends Suggested next steps:
No other correctness issues found in this change. |
Summary
Fixes remote reference resolution when
--baseis supplied as an HTTP(S) URL.ResolveBasePathForFilecurrently converts every explicit base value usingfilepath.Abs(). This changes a URL into a local filesystem path, so external$refdocuments are resolved through a different code path.This change preserves explicit HTTP(S) base URLs while retaining absolute-path
normalization for local base paths.
Validation
go test ./cmd.Reproduction
I used internal YAML files and hosts for exploring this, which I cannot share. Here's the gist of it: