Skip to content

chore: upgrade jsonschema to 0.40 and schemars to 1.2#43

Merged
Artifizer merged 2 commits intoGlobalTypeSystem:mainfrom
yoskini:chore/bump_old_deps
Jan 30, 2026
Merged

chore: upgrade jsonschema to 0.40 and schemars to 1.2#43
Artifizer merged 2 commits intoGlobalTypeSystem:mainfrom
yoskini:chore/bump_old_deps

Conversation

@yoskini
Copy link
Copy Markdown
Collaborator

@yoskini yoskini commented Jan 27, 2026

  • Update jsonschema dependency from 0.18 to 0.40
    • Update schemars dependency from 0.8 to 1.2
    • Adapt to new jsonschema API:
      • Replace JSONSchema::compile with validator_for
      • Replace validate().is_err() pattern with iter_errors
      • Update validation error handling to use iterator pattern
    • Adapt to new schemars API:
      • Change schema_name() return type to Cow<'static, str>
      • Remove deprecated is_referenceable() method
      • Rebuild Json

@yoskini yoskini force-pushed the chore/bump_old_deps branch from 62d329a to 1451641 Compare January 27, 2026 17:23
@yoskini yoskini closed this Jan 27, 2026
@yoskini yoskini reopened this Jan 27, 2026
- Update jsonschema dependency from 0.18 to 0.40
- Update schemars dependency from 0.8 to 1.2
- Adapt to new jsonschema API:
  - Replace JSONSchema::compile with validator_for
  - Replace validate().is_err() pattern with iter_errors
  - Update validation error handling to use iterator pattern
- Adapt to new schemars API:
  - Change schema_name() return type to Cow<'static, str>
  - Remove deprecated is_referenceable() method
  - Rebuild Json

Signed-off-by: Fabio Del Vigna <fabio.delvigna@acronis.com>
@yoskini yoskini force-pushed the chore/bump_old_deps branch from 1451641 to 05ee646 Compare January 28, 2026 11:11
Comment thread gts-macros/src/lib.rs
Comment thread gts/src/gts.rs Outdated
Comment thread gts/src/gts.rs
Comment thread gts/src/gts.rs Outdated
Comment thread gts/src/store.rs
…a validation

- Implement GtsRetriever struct with jsonschema::Retrieve trait
  - Pre-populate retriever with all schemas from store using gts:// URI format
  - Add debug logging for URI resolution attempts and failures
  - Handle only gts:// scheme URIs, reject unknown schemes
- Update register_schema validation logic:
  - Skip jsonschema compilation for schemas with gts:// references during registration
  - Allow forward references (schemas referencing not

Signed-off-by: Fabio Del Vigna <fabio.delvigna@acronis.com>
@yoskini yoskini force-pushed the chore/bump_old_deps branch from 1be8458 to c9d8fc6 Compare January 28, 2026 13:12
Comment thread gts-macros/src/lib.rs
if let Some(props_obj) = properties.as_object_mut() {
for (_key, value) in props_obj.iter_mut() {
if let Some(ref_str) = value.get("$ref").and_then(|v| v.as_str()) {
if ref_str == "#/$defs/GtsInstanceId" {
Copy link
Copy Markdown
Contributor

@Artifizer Artifizer Jan 30, 2026

Choose a reason for hiding this comment

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

I see you introduce #/$defs/GtsInstanceId ... , that probably means the other ways of GTS ID reference are deprecated now, correct?

If yes, we'd need to:

  1. Ensure all examples in all https://github.com/GlobalTypeSystem/ repos now switch to this new notation
  2. Ensure spec documentation explains it @ https://github.com/GlobalTypeSystem/gts-spec
  3. Ensure we have new pytests implemented in https://github.com/GlobalTypeSystem/gts-spec/tree/main/tests
  4. Ensure we have proper notation being used @ https://github.com/hypernetix/hyperspot

Copy link
Copy Markdown
Collaborator Author

@yoskini yoskini Jan 30, 2026

Choose a reason for hiding this comment

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

No, #/$defs/GtsInstanceId is not a new user-facing notation - it's an internal implementation detail that we immediately resolve.

This is purely a side effect of the schemars 0.8 → 1.2 upgrade. The schemars library changed how it generates schemas for custom types:

Before (schemars 0.8) - schemas were inlined:

{
  "properties": {
    "id": {
      "type": "string",
      "format": "gts-instance-id"
    }
  }
}

After (schemars 1.2) - schemas use $ref to $defs:

{
  "properties": {
    "id": {
      "$ref": "#/$defs/GtsInstanceId"
    }
  },
  "$defs": {
    "GtsInstanceId": {
      "type": "string",
      "format": "gts-instance-id"
    }
  }
}

In this fix the macro immediately resolves these back to inline schemas:

if ref_str == "#/$defs/GtsInstanceId" {
    *value = gts::GtsInstanceId::json_schema_value();
}

The #/$defs/GtsInstanceId pattern never appears in final schemas - it's resolved at compile time during macro expansion.

@Artifizer Artifizer self-requested a review January 30, 2026 01:04
@Artifizer Artifizer merged commit c165a50 into GlobalTypeSystem:main Jan 30, 2026
6 checks passed
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.

3 participants