Skip to content

Support bundled schemas with custom meta-schemas#779

Merged
jviotti merged 1 commit into
mainfrom
meta-bundle
Jun 12, 2026
Merged

Support bundled schemas with custom meta-schemas#779
jviotti merged 1 commit into
mainfrom
meta-bundle

Conversation

@jviotti

@jviotti jviotti commented Jun 12, 2026

Copy link
Copy Markdown
Member

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Review in cubic

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti marked this pull request as ready for review June 12, 2026 18:37
@jviotti jviotti merged commit f94a8eb into main Jun 12, 2026
15 checks passed
@jviotti jviotti deleted the meta-bundle branch June 12, 2026 18:42
@augmentcode

augmentcode Bot commented Jun 12, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR improves support for self-contained/bundled schemas that use custom meta-schemas by allowing embedded meta-schemas to be discovered and preferred during dialect/base-dialect/vocabulary resolution.

Changes:

  • Bumps the vendored blaze dependency to a newer revision.
  • Adds metaschema_try_embedded to locate a schema’s meta-schema inside the document (via $defs/definitions) and validates the embedded meta-schema chain against an official base dialect.
  • Updates metaschema(), base_dialect(), and vocabularies() to prefer embedded meta-schemas over resolver-provided ones when present.
  • Extends SchemaFrame to probe/cache embedded meta-schemas during analysis and reuse them for vocabulary resolution.
  • Changes SchemaKeywordIterator to take explicit vocabularies (removing resolver/default-dialect dependency) and updates the compiler accordingly.
  • Adjusts bundling dependency traversal to report but not recurse into official schemas.
  • Adds new CLI regression tests (pass_bundled_metaschema) across fmt/validate/bundle/inspect/compile/codegen/lint/metaschema/test, and removes the install docs warning that required manual dependency ordering.

Technical Notes: Embedded meta-schema precedence aims to make bundled documents self-descriptive, avoiding reliance on external resolver availability for custom dialects.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

///
/// Try to locate the meta-schema that the given schema declares from within
/// the schema itself, as self-contained schemas embed the meta-schemas they
/// depend on. The result points into the given document and is null if no

@augmentcode augmentcode Bot Jun 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring for metaschema_try_embedded says it “is null if no valid embedded meta-schema could be found”, but the implementation can throw (e.g., on cycles or missing/invalid $schema while walking the embedded chain). Consider clarifying the API contract here (return-null vs throw-on-invalid) so callers don’t treat it as a non-throwing probe.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

sourcemeta::core::JSON::String root_;
Locations locations_;
References references_;
// Custom meta-schemas that the resolver could not resolve but that were

@augmentcode augmentcode Bot Jun 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says probed_metaschemas_ only tracks meta-schemas “that the resolver could not resolve”, but SchemaFrame::analyse now checks metaschema_try_embedded before delegating to the resolver (so it can cache embedded meta-schemas even if the resolver would have resolved them). Consider tightening the wording to match the precedence behavior.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jun 18, 2026
⚠️ **CAUTION: this is a major update, indicating a breaking change!** ⚠️

This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [sourcemeta/jsonschema](https://github.com/sourcemeta/jsonschema) | major | `v15.11.0` → `v16.0.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>sourcemeta/jsonschema (sourcemeta/jsonschema)</summary>

### [`v16.0.0`](https://github.com/sourcemeta/jsonschema/releases/tag/v16.0.0)

[Compare Source](sourcemeta/jsonschema@v15.11.0...v16.0.0)

#### What's Changed

- Support bundled schemas with custom meta-schemas by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;779](sourcemeta/jsonschema#779)
- Support `dependentSchemas` and `dependentRequired` on `codegen` by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;780](sourcemeta/jsonschema#780)

#### Breaking Changes

- Use system `libcurl` through `dlopen` on Linux/BSD by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;781](sourcemeta/jsonschema#781)

Before this release, the Linux pre-compiled binaries were built against a vendored static copy of cURL. While that worked in most cases, it relied on a very specific CA certificate store. Making it problematic if you need more runtime control over that in your actual target installation.

So instead of linking against a specific version of cURL in the system (and therefore probably breaking some distros no matter what), we take a more dynamic approach: we can at runtime try to find an appropriate cURL library we can use (probing lots of popular paths across distros), and dynamically load it.

Most Linux systems have cURL installed out of the box, otherwise you get a friendly runtime error instructing you on how to fix it or point to a custom one of your choice.

**Full Changelog**: <sourcemeta/jsonschema@v15.11.0...v16.0.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjcuMSIsInVwZGF0ZWRJblZlciI6IjQzLjIyNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWFqb3IiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant