rakutentech / laravel-request-docs

Effortless API documentation tool for Laravel applications. Swagger alternative.
MIT License
717 stars 106 forks source link

Ability to force a DELETE to have a payload instead of query params #369

Closed abodnar closed 2 months ago

abodnar commented 5 months ago

I recently implemented an endpoint in my application that is doing a DELETE and expects a body to be sent.

{
   "ids": [array,of,ids]
}

When I looked at it in LRD, I noticed it showed my expected payload as query params, which doesn't work. But if I make a call to it using Postman with the data as a body in the request, it works fine.

I haven't been able to find anyway to override thru a docblock or a configuration setting. When looking through past issues, I came across https://github.com/rakutentech/laravel-request-docs/pull/270 and it mentioned that OpenAPI discourages it and implemented an option for allowing it for OpenAPI export, but that doesn't work for the LRD interface.

While OpenAPI discourages, we should be able to force it either through config or be able to set it in a docblock.

kevincobain2000 commented 5 months ago

I see

Excluding request body while generating the delete request. As OpenAPI3 discourages request body

https://github.com/rakutentech/laravel-request-docs/blob/cb6264beb7dfb85b53b5dcf403a7f52215a562c6/ui/src/components/ApiAction.tsx#L102-L110

https://github.com/rakutentech/laravel-request-docs/pull/270/files#diff-6b084ea21f7517751e99e60542a1a1caf142be938be8535a6a429f9f88458271R77

We can put that back, if you can submit a PR?

abodnar commented 4 months ago

I'll work on getting you a PR soon