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