Skip to content

Commit f20a682

Browse files
committed
docs: Update Readme
1 parent 1707a9a commit f20a682

1 file changed

Lines changed: 4 additions & 35 deletions

File tree

README.md

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ $schema->toArray();
7878

7979
// Convert to JSON string
8080
$schema->toJson();
81+
$schema->toJson(JSON_PRETTY_PRINT);
8182

8283
$data = [
8384
'name' => 'John Doe',
84-
'email' => 'john@example.com',
85+
'email' => 'foo', // invalid email
8586
'age' => 16,
8687
'active' => true,
8788
'settings' => [
@@ -97,7 +98,7 @@ try {
9798
}
9899

99100
// Or just get a boolean
100-
$schema->isValid($data);
101+
$schema->isValid($data); // false
101102
```
102103

103104
## Available Schema Types
@@ -453,40 +454,8 @@ $schema
453454

454455
## Converting to JSON Schema
455456

456-
You can convert any schema to a JSON Schema array or JSON string:
457-
458-
```php
459-
// Convert to array
460-
$jsonSchemaArray = $schema->toArray();
461-
462-
// Convert to JSON string
463-
$jsonSchemaString = $schema->toJson();
464-
$jsonSchemaString = $schema->toJson(JSON_PRETTY_PRINT);
465-
```
466-
467-
This will output a valid JSON Schema that can be used with any JSON Schema validator.
457+
TODO
468458

469-
Example JSON output:
470-
```json
471-
{
472-
"$schema": "http://json-schema.org/draft-07/schema#",
473-
"type": "object",
474-
"title": "user",
475-
"description": "User schema",
476-
"required": ["name", "email"],
477-
"properties": {
478-
"name": {
479-
"type": "string",
480-
"minLength": 2,
481-
"maxLength": 100
482-
},
483-
"email": {
484-
"type": "string",
485-
"format": "email"
486-
}
487-
}
488-
}
489-
```
490459

491460
## Credits
492461

0 commit comments

Comments
 (0)