Skip to content

Try It Now with Array Datas When Nullable #990

@oralunal

Description

@oralunal

Scribe version

5.2.0

PHP version

8.2

Laravel version

12.10.2

Scribe config

laravel.middleware.0 => "web"
laravel.middleware.1 => "scribe.auth"
auth.enabled => true
auth.placeholder => "{BEARER_TOKEN}"
examples.faker_seed => null

What happened?

I use the following FormRequest:

    public function rules(): array
    {
        return [
            'instagram_user_id' => [
                'nullable',
            ],
            'instagram_user_id.*' => [
                'int',
            ];
    }

Users should be able to leave the instagram_user_id field empty. However, when I use the “Try it out” feature in Scribe, it doesn’t send an empty value—instead, it sends something like instagram_user_id = [null, null]. This causes a validation error because instagram_user_id.* expects integers, but gets null values instead.

Expected Behavior

When using the “Try it out” feature in Scribe, if the instagram_user_id field is left empty, the request should either:

  • Not include the instagram_user_id key at all,
    or
  • Send it as an empty array: instagram_user_id: []

This way, the validation passes because:

  • The field is nullable
  • And there are no non-integer (e.g., null) values inside the array that would trigger the instagram_user_id.* => int rule

Docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions