Skip to content

Commit 32c20ae

Browse files
committed
docs: Update changelog
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent 2d533da commit 32c20ae

File tree

2 files changed

+70
-4
lines changed

2 files changed

+70
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Changed
66

7+
- **BREAKING**: `BasicOutput` and `Annotations` no longer have lifetime parameters. Update type annotations from `BasicOutput<'a>` to `BasicOutput` and `Annotations<'a>` to `Annotations`.
78
- `referencing`: URI caching now avoids hash collisions and reduces lock contention.
89
- Update `fluent-uri` to `0.4.1`.
910
- Bump MSRV to `1.83.0`.
@@ -27,7 +28,8 @@
2728

2829
### Removed
2930

30-
- `Validator::config` to reduce the memory footprint.
31+
- **BREAKING**: `Validator::config` to reduce the memory footprint.
32+
- **BREAKING**: Public `DRAFT4_META_VALIDATOR`, `DRAFT6_META_VALIDATOR`, `DRAFT7_META_VALIDATOR`, `DRAFT201909_META_VALIDATOR`, and `DRAFT202012_META_VALIDATOR` statics. Use `draftX::meta::validator()` helper functions instead (e.g., `draft7::meta::validator()`).
3133

3234
## [0.33.0] - 2025-08-24
3335

MIGRATION.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,82 @@
22

33
## Upgrading from 0.33.x to 0.34.0
44

5-
Meta-schema helpers moved to `draftX::meta::validator()` so `MetaValidator` exposes the same handle on native and wasm targets. Dropping the `Send + Sync` bounds for retrievers means the old `LazyLock` statics can’t store validators on `wasm32` anymore, so the new helper borrows cached validators on native platforms and builds owned copies on WebAssembly.
5+
### Removed `Validator::config()`
6+
7+
The `Validator::config()` method has been removed to reduce memory footprint. The validator no longer stores the configuration internally.
68

79
```rust
810
// Old (0.33.x)
9-
let validator = jsonschema::draft7::meta::VALIDATOR;
10-
validator.is_valid(&schema);
11+
let validator = jsonschema::validator_for(&schema)?;
12+
let config = validator.config(); // Returns Arc<ValidationOptions>
13+
14+
// New (0.34.x)
15+
// No replacement - the config is not stored after compilation
16+
// If you need config values, keep a reference to your ValidationOptions
17+
let options = jsonschema::options().with_draft(Draft::Draft7);
18+
let validator = options.build(&schema)?;
19+
// Keep `options` around if you need to access configuration later
20+
```
21+
22+
### Meta-validator statics replaced with functions
23+
24+
Public `DRAFT*_META_VALIDATOR` statics have been removed. Use the new `draftX::meta::validator()` helper functions instead. Dropping the `Send + Sync` bounds for retrievers means the old `LazyLock` statics can't store validators on `wasm32` anymore, so the new helper borrows cached validators on native platforms and builds owned copies on WebAssembly.
25+
26+
```rust
27+
// Old (0.33.x)
28+
use jsonschema::DRAFT7_META_VALIDATOR;
29+
DRAFT7_META_VALIDATOR.is_valid(&schema);
30+
31+
// Also removed:
32+
use jsonschema::DRAFT4_META_VALIDATOR;
33+
use jsonschema::DRAFT6_META_VALIDATOR;
34+
use jsonschema::DRAFT201909_META_VALIDATOR;
35+
use jsonschema::DRAFT202012_META_VALIDATOR;
1136

1237
// New (0.34.x)
1338
let validator = jsonschema::draft7::meta::validator();
1439
validator.is_valid(&schema);
40+
41+
// Or use the module-specific helper:
42+
jsonschema::draft7::meta::is_valid(&schema);
1543
```
1644

45+
### Lifetime parameters removed from output types
46+
47+
`BasicOutput` and `Annotations` no longer have lifetime parameters. This simplifies the API and uses `Arc` for internal ownership.
48+
49+
```rust
50+
// Old (0.33.x)
51+
fn process_output<'a>(output: BasicOutput<'a>) -> Result<(), Error> {
52+
match output {
53+
BasicOutput::Valid(units) => {
54+
for unit in units {
55+
let annotations: &Annotations<'a> = unit.annotations();
56+
// ...
57+
}
58+
}
59+
BasicOutput::Invalid(errors) => { /* ... */ }
60+
}
61+
Ok(())
62+
}
63+
64+
// New (0.34.x)
65+
fn process_output(output: BasicOutput) -> Result<(), Error> {
66+
match output {
67+
BasicOutput::Valid(units) => {
68+
for unit in units {
69+
let annotations: &Annotations = unit.annotations();
70+
// ...
71+
}
72+
}
73+
BasicOutput::Invalid(errors) => { /* ... */ }
74+
}
75+
Ok(())
76+
}
77+
```
78+
79+
### WASM: Relaxed `Send + Sync` bounds
80+
1781
`Retrieve` / `AsyncRetrieve` on `wasm32` no longer require `Send + Sync`.
1882

1983
```rust

0 commit comments

Comments
 (0)