docs: Update code samples in README

This commit is contained in:
Dmitry Dygalo 2023-03-16 12:42:11 +01:00
parent aae445cd2d
commit 64f3e02ede
No known key found for this signature in database
GPG Key ID: AE7D12BE93BD417F
1 changed files with 5 additions and 5 deletions

View File

@ -85,15 +85,15 @@ fn main() {
```rust ```rust
use jsonschema::{Output, BasicOutput, JSONSchema}; use jsonschema::{Output, BasicOutput, JSONSchema};
use serde_json::json;
fn main() { fn main() {
let schema_json = serde_json::json!({ let schema_json = json!({
"title": "string value", "title": "string value",
"type": "string" "type": "string"
}); });
let instance = serde_json::json!{"some string"}; let instance = json!("some string");
let schema = JSONSchema::options() let schema = JSONSchema::compile(&schema_json)
.compile(&schema_json)
.expect("A valid schema"); .expect("A valid schema");
let output: BasicOutput = schema.apply(&instance).basic(); let output: BasicOutput = schema.apply(&instance).basic();
@ -102,7 +102,7 @@ fn main() {
assert_eq!( assert_eq!(
output_json, output_json,
serde_json::json!({ json!({
"valid": true, "valid": true,
"annotations": [ "annotations": [
{ {