generated from spatie/package-skeleton-laravel
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 178
 
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
I have a model with the following cast:
    protected function casts(): array
    {
        return [
            'start_date' => 'datetime:Y-m-d',
        ];
    }
Looking at the open API string formats
https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
I would expect scramble to add the date format in this case rather than the date-time, but I am seeing:
start_date: string<date-time>
created_at: string<date-time>
I came across this PR which seems to automatically apply the date format rather than date-time but only for request validation, NOT for eloquent casts
Is this intended behaviour, or do you know of another way I can get it to say string?
Thanks!
How to reproduce the bug
Create an eloquent model with a date attribute named start_date and add the following cast:
    protected function casts(): array
    {
        return [
            'start_date' => 'datetime:Y-m-d',
        ];
    }
Create an API resource
    public function toArray(Request $request): array
    {
        return [
            'start_date' => $this->start_date,
        ];
    }
I expect to see this showing as string in the scramble docs rather than string
Package Version
0.12.19
PHP Version
8.3
Laravel Version
11.45.0
Which operating systems does with happen with?
No response
Notes
No response
Dylan-JFisher
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working