Skip to content

Commit

Permalink
docs: Update MIGRATION.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 authored Feb 8, 2025
1 parent d8df940 commit 620b1b9
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,47 @@ impl Retrieve for MyRetriever {

This is a type-level change only; the behavior and available methods remain the same.

The Registry API has been simplified to use a consistent builder pattern. Replace direct creation methods with `Registry::options()`:

```rust
// Before (0.28.x)
let registry = Registry::options()
.draft(Draft::Draft7)
.try_new(
"http://example.com/schema",
resource
)?;

let registry = Registry::options()
.draft(Draft::Draft7)
.try_from_resources([
("http://example.com/schema", resource)
].into_iter())?;

let registry = Registry.try_with_resource_and_retriever(
"http://example.com/schema",
resource,
retriever
)?;

// After (0.29.0)
let registry = Registry::options()
.draft(Draft::Draft7)
.build([
("http://example.com/schema", resource)
])?;

let registry = Registry::options()
.draft(Draft::Draft7)
.build([
("http://example.com/schema", resource)
])?;

let registry = Registry::options()
.retriever(retriever)
.build(resources)?;
```

## Upgrading from 0.25.x to 0.26.0

The `Validator::validate` method now returns `Result<(), ValidationError<'i>>` instead of an error iterator. If you need to iterate over all validation errors, use the new `Validator::iter_errors` method.
Expand Down

0 comments on commit 620b1b9

Please sign in to comment.