Skip to content

[Bug]: data-wrap in Response Example on Resource::collection response without wrapping #1226

Description

@wiegandj

What happened?

Hi.

The generated response example looks like this:

{
  "data": [
    {
      ...
    }
  ]
}

While my real api output looks like this:

[
    {
        ...
    }
]

The output on my controller:

AnonymousResourceCollection::withoutWrapping();
return ModelResource::collection($response->json());

Scramble does not detect the withoutWrapping() for my ResourceCollection.

How to reproduce the bug

Return a Resource::collection() after using AnonymousResourceCollection::withoutWrapping() to remove the 'data' wrap.

Scramble still uses "data" as a wrapper in the response example.

Package Version

0.13.34

PHP Version

8.4.20

Laravel Version

11.45.1

Which operating systems does with happen with?

No response

Notes

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions