Skip to content

Commit 0b16fc1

Browse files
author
Antoine Lelaisant
committed
fix: make ObjectSchema implements JsonSchemaInterface
1 parent 79733f8 commit 0b16fc1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/ObjectSchema.php

+20
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,24 @@ public function getSchema(): array
6868
'required' => $this->required,
6969
];
7070
}
71+
72+
/**
73+
* {@inheritdoc}
74+
*/
75+
public function jsonSerialize(): array
76+
{
77+
$schema = $this->getSchema();
78+
79+
/**
80+
* @var array<string, mixed>&array{title: string, description: string, examples: array<T>}
81+
*/
82+
return array_merge(
83+
$schema,
84+
[
85+
'title' => $this->getTitle(),
86+
'description' => $this->getDescription(),
87+
'examples' => [...$this->getExamples()],
88+
],
89+
);
90+
}
7191
}

0 commit comments

Comments
 (0)