knuckleswtf / knuckleswtf/scribe
When adding object[] in Docblock it is wrongly sending request
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 357
- PR merge metrics
- No merged PRs in 30d
Description
### Scribe version
4.38.0
### PHP version
8.2.12
### Framework
Laravel
### Framework version
11.31
### Scribe config
```ruby
auth.enabled => true
```
### What happened?
```php
/**
* Create a new event
*
* This endpoint is used to create a new event.
*
* @authenticated
*
* @bodyParam media file required The cover image of the event.
* @bodyParam title string required The title of the event. Example: My Event
* @bodyParam description string required The description of the event. Example: This is an event
* @bodyParam start_date date required The start date of the event. Example: 27-11-2024 10:00
* @bodyParam end_date date required The end date of the event. Example: 27-11-2024 12:00
* @bodyParam schedules object[] The schedules of the event.
* @bodyParam schedules[].date date required The date of the schedule. Example: 27-11-2024 10:00
* @bodyParam schedules[].detail string required The detail of the schedule. Example: This is a schedule
*/
public function store(Request $request): JsonResponse
{
$data = $request->validate([
'media' => 'required|file|mimes:jpeg,png,jpg|max:2048',
'title' => 'required|string|max:255',
'description' => 'required|string',
'start_date' => 'required|date_format:d-m-Y H:i',
'end_date' => 'required|date_format:d-m-Y H:i',
'schedules' => 'nullable|array',
'schedules.*.date' => 'required|date_format:d-m-Y H:i',
'schedules.*.detail' => 'required|string'
]);
}
```
For the above, `Content-Type: multipart/form-data` When i click on `Send Request` it sending `schedules_0_date: 27-11-2024 10:00` and `schedules_0_detail: 'This is a schedule'`.
It should be send as
`
schedules: [{
date: "27-11-2024 10:00"
detail: "This is a schedule"
}]
`


### Docs
- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution
Contributor guide
Research direction
Reproduce the issue from the shown @bodyParam schedules object[] definition using the generated documentation's Send Request control and multipart/form-data. Trace how that request is assembled; done means the nested values are sent under schedules as an array/object rather than flattened schedules_0_date and schedules_0_detail fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100