feat: support URL mapping in resolve --bundle + validate --schema#27
Merged
feat: support URL mapping in resolve --bundle + validate --schema#27
resolve --bundle + validate --schema#27Conversation
3P extension authors write schemas that reference UCP core types via absolute URIs (e.g., $ref: "https://ucp.dev/schemas/shopping/types/ variant.json"). This is the correct form for published schemas — the extension lives on a different host than the types it extends. Previously, `resolve --bundle` and `validate --schema` explicitly rejected --schema-remote-base/--schema-local-base flags for direct schema file input (commit 6ab9252). The guard was added to prevent flags from being silently ignored, since at the time all development was in-repo with co-located files and relative refs. The underlying infrastructure (bundle_refs_with_url_mapping, bundle_refs_remote) already supported URL mapping and HTTP fetch — it just wasn't wired up for these code paths. Solution -------- 1. Remove the guards in resolve and validate that rejected base flags for schema file / explicit --schema input. 2. Wire bundle_refs_with_url_mapping into resolve --bundle when --schema-remote-base/--schema-local-base are present. This maps absolute URL $ref values to local files during bundling. 3. Add HTTP fetch fallback in bundle_refs_inner: when local path resolution fails for an absolute URL $ref and no URL mapping is configured, fall back to load_schema_url() to fetch over HTTP. This enables zero-config usage for online development. The result is two resolution modes for absolute URL refs: - Online (default): fetches referenced schemas from their URLs - Offline: --schema-remote-base/--schema-local-base maps URLs to local copies, same as compose already supported validate --schema inherits the same fix via bundle_local_refs(), which already dispatched to bundle_refs_with_url_mapping when flags were present — the guard was the only thing preventing it.
wry-ry
approved these changes
Apr 28, 2026
Reuse bundle_local_refs() (already used by run_validate) and hoist the verbose log out of the if-let branches.
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.
3P extension authors write schemas that reference UCP core types via absolute URIs (e.g.,
$ref: "https://ucp.dev/schemas/shopping/types/variant.json"). This is the correct form for published schemas — the extension lives on a different host than the types it extends.resolve --bundleandvalidate --schemacurrently reject--schema-remote-base/--schema-local-baseflags for direct schema file input, making it impossible to bundle these schemas locally. The underlying infrastructure already supported URL mapping and HTTP fetch — it just wasn't wired up for these code paths. With this update...Online works by default
Offline / CI — map URLs to local copies
Validate with explicit schema
Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)