Skip to content

Commit

Permalink
refactor: access $collectingResourceType for deciding on wrapping (#517)
Browse files Browse the repository at this point in the history
accesses the $collectingResourceType property to decide whether to wrap a resource collection in a `data` array or not
  • Loading branch information
axelrindle authored Sep 22, 2024
1 parent 9bfd11b commit 24dd581
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function toResponse(Type $type)

$jsonResourceOpenApiType = $this->openApiTransformer->transform($collectingResourceType);

$shouldWrap = ($wrapKey = AnonymousResourceCollection::$wrap ?? null) !== null
$shouldWrap = ($wrapKey = $collectingResourceType->name::$wrap ?? null) !== null
|| $additional instanceof KeyedArrayType;
$wrapKey = $wrapKey ?: 'data';

Expand Down

0 comments on commit 24dd581

Please sign in to comment.