Skip to content

Commit 55a4e41

Browse files
Will-thomsoyuka
authored andcommitted
Simplify JSON:API collection schema properties
1 parent 91c0b15 commit 55a4e41

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/JsonApi/JsonSchema/SchemaFactory.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,15 @@ public function buildSchema(string $className, string $format = 'jsonapi', strin
259259
$properties = $this->buildDefinitionPropertiesSchema($key, $className, $format, $type, $operation, $schema, []);
260260
$properties['data']['properties']['attributes']['$ref'] = $prefix.$key;
261261

262-
$collectionProperties = [
263-
'data' => [
264-
'type' => 'array',
265-
'items' => $properties['data'],
266-
],
262+
$properties['data'] = [
263+
'type' => 'array',
264+
'items' => $properties['data'],
267265
];
268266

269-
if (isset($properties['included'])) {
270-
$collectionProperties['included'] = $properties['included'];
271-
}
272-
273267
$schema['description'] = "$definitionName collection.";
274268
$schema['allOf'] = [
275269
['$ref' => $prefix.(false === $operation->getPaginationEnabled() ? self::COLLECTION_BASE_SCHEMA_NAME_NO_PAGINATION : self::COLLECTION_BASE_SCHEMA_NAME)],
276-
['type' => 'object', 'properties' => $collectionProperties],
270+
['type' => 'object', 'properties' => $properties],
277271
];
278272

279273
return $schema;

0 commit comments

Comments
 (0)