Skip to content

Commit 8ea1cc8

Browse files
MchMichaelMichael Mochulsky
andauthored
Added checking for accessors methods to prevent linking to unexisting shema (#19)
Co-authored-by: Michael Mochulsky <[email protected]>
1 parent c988145 commit 8ea1cc8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Definitions/DefinitionGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ function generateSchemas(): array {
161161
$type = $returnType->getName();
162162

163163
if (Str::contains($type, '\\')) {
164-
$data = [
165-
'type' => 'object',
166-
'$ref' => '#/components/schemas/' . last(explode('\\', $type)),
167-
];
164+
$data = ['type' => 'object'];
165+
if (is_subclass_of($type, Model::class)) {
166+
$data['$ref'] = '#/components/schemas/' . last(explode('\\', $type));
167+
}
168168
} else {
169169
$data['type'] = $type;
170170
$this->addExampleKey($data);

0 commit comments

Comments
 (0)