Skip to content

Commit 8235126

Browse files
committed
Don't include empty schema
1 parent f3669bd commit 8235126

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/OpenApi/OpenApiGenerator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,12 @@ private function buildSchema(Resource $resource, array $schema, array $overrides
9595
'properties' => [
9696
'type' => ['type' => 'string', 'const' => $resource->type()],
9797
'id' => ['type' => 'string'],
98-
'attributes' => ['type' => 'object'] + ($schema['attributes'] ?? []),
99-
'relationships' => ['type' => 'object'] + ($schema['relationships'] ?? []),
98+
'attributes' => !empty($schema['attributes'])
99+
? ['type' => 'object'] + $schema['attributes']
100+
: [],
101+
'relationships' => !empty($schema['relationships'])
102+
? ['type' => 'object'] + $schema['relationships']
103+
: [],
100104
],
101105
],
102106
$overrides,

0 commit comments

Comments
 (0)