Skip to content

Commit

Permalink
fix: make ObjectSchema implements JsonSchemaInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Lelaisant committed Oct 21, 2022
1 parent 79733f8 commit 0b16fc1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ObjectSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,24 @@ public function getSchema(): array
'required' => $this->required,
];
}

/**
* {@inheritdoc}
*/
public function jsonSerialize(): array
{
$schema = $this->getSchema();

/**
* @var array<string, mixed>&array{title: string, description: string, examples: array<T>}
*/
return array_merge(
$schema,
[
'title' => $this->getTitle(),
'description' => $this->getDescription(),
'examples' => [...$this->getExamples()],
],
);
}
}

0 comments on commit 0b16fc1

Please sign in to comment.