Support bundled schemas with custom meta-schemas#779
Conversation
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
🤖 Augment PR SummarySummary: 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:
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 👎 |
| /// | ||
| /// 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 |
There was a problem hiding this comment.
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
🤖 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 |
There was a problem hiding this comment.
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
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
⚠️ **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 [@​jviotti](https://github.com/jviotti) in [#​779](sourcemeta/jsonschema#779) - Support `dependentSchemas` and `dependentRequired` on `codegen` by [@​jviotti](https://github.com/jviotti) in [#​780](sourcemeta/jsonschema#780) #### Breaking Changes - Use system `libcurl` through `dlopen` on Linux/BSD by [@​jviotti](https://github.com/jviotti) in [#​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=-->
Signed-off-by: Juan Cruz Viotti jv@jviotti.com