chore: upgrade jsonschema to 0.40 and schemars to 1.2#43
chore: upgrade jsonschema to 0.40 and schemars to 1.2#43Artifizer merged 2 commits intoGlobalTypeSystem:mainfrom
Conversation
62d329a to
1451641
Compare
- 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>
1451641 to
05ee646
Compare
…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>
1be8458 to
c9d8fc6
Compare
| 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" { |
There was a problem hiding this comment.
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:
- Ensure all examples in all https://github.com/GlobalTypeSystem/ repos now switch to this new notation
- Ensure spec documentation explains it @ https://github.com/GlobalTypeSystem/gts-spec
- Ensure we have new pytests implemented in https://github.com/GlobalTypeSystem/gts-spec/tree/main/tests
- Ensure we have proper notation being used @ https://github.com/hypernetix/hyperspot
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.