Request param with rule date_format:H:i has incorrect format
#979
-
|
Hi everyone, I'm having an issue with a class MyRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, string>
*/
public function rules(): array
{
return [
'my_param' => ['required', 'string', 'date_format:H:i']
];
}
}It might seem strange, but the aim of this request body is to be sure to have as input a valid time string (excluding seconds). For example: {
"my_param" : "15:30"
}The generated openapi specification for this request body gives the additional information of {
"schemas": {
"MyRequest": {
"type": "object",
"properties": {
"my_param": {
"type": "string",
"format": "date" // <-- Is it really a date-string?
}
},
"required": [
"my_param"
],
"title": "MyRequest"
}
}
}This format causes me an issue with my
and so on... If this is not possible, can I override the format in the request body? I tried to put a phpdoc over the field as I used to do in public function rules(): array
{
return [
/** @format H:i */
'my_param' => ['required', 'string', 'date_format:H:i']
];
}For this purpose I created a branch for reproduction on this repository: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hey @apasquini95 Yup, seems legit! Would you mind creating a PR? It also looks like a simple one! |
Beta Was this translation helpful? Give feedback.
Hey @apasquini95
Yup, seems legit!
Would you mind creating a PR? It also looks like a simple one!