Skip to content

Commit 669a033

Browse files
committed
config doc typo and delete_with_body query check issue resolved
1 parent 64325d6 commit 669a033

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

config/request-docs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@
5858
'description' => 'Laravel Request Docs',
5959
// default version that this library provides
6060
'version' => '3.0.0',
61-
//changeable
61+
// changeable
6262
'document_version' => '1.0.0',
6363
// license that you want to display
6464
'license' => 'Apache 2.0',
6565
'license_url' => 'https://www.apache.org/licenses/LICENSE-2.0.html',
6666
'server_url' => env('APP_URL', 'http://localhost'),
67-
//openapi 3.0.x doesn't support request body for develop operation
67+
//openapi 3.0.x doesn't support request body for delete operation
6868
//ref: https://github.com/OAI/OpenAPI-Specification/pull/2117
69-
'include_body_on_delete' => false,
69+
'delete_with_body' => false,
7070
//exclude http methods that will be excluded from openapi export
7171
'exclude_http_methods' => [],
7272
// for now putting default responses for all. This can be changed later based on specific needs

src/LaravelRequestDocsToOpenApi.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function openApi(array $docs): LaravelRequestDocsToOpenApi
3333
private function docsToOpenApi(array $docs): void
3434
{
3535
$this->openApi['paths'] = [];
36-
$includeBodyForDelete = config('request-docs.open_api.include_body_on_delete', false);
36+
$deleteWithBody = config('request-docs.open_api.delete_with_body', false);
3737
$excludeHttpMethods = array_map(fn ($item) => strtolower($item), config('request-docs.open_api.exclude_http_methods', []));
3838

3939
foreach ($docs as $doc) {
@@ -74,7 +74,7 @@ private function docsToOpenApi(array $docs): void
7474

7575
$contentType = $requestHasFile ? 'multipart/form-data' : 'application/json';
7676

77-
if ($isPost || $isPut || ($isDelete && $includeBodyForDelete)) {
77+
if ($isPost || $isPut || ($isDelete && $deleteWithBody)) {
7878
$this->openApi['paths'][$uriLeadingSlash][$httpMethod]['requestBody'] = $this->makeRequestBodyItem($contentType);
7979
}
8080

@@ -84,7 +84,7 @@ private function docsToOpenApi(array $docs): void
8484
$parameter = $this->makeQueryParameterItem($attribute, $rule);
8585
$this->openApi['paths'][$uriLeadingSlash][$httpMethod]['parameters'][] = $parameter;
8686
}
87-
if ($isPost || $isPut || ($isDelete && $includeBodyForDelete)) {
87+
if ($isPost || $isPut || ($isDelete && $deleteWithBody)) {
8888
$this->openApi['paths'][$uriLeadingSlash][$httpMethod]['requestBody']['content'][$contentType]['schema']['properties'][$attribute] = $this->makeRequestBodyContentPropertyItem($rule);
8989
}
9090
}
@@ -102,7 +102,6 @@ protected function makeQueryParameterItem(string $attribute, $rule): array
102102
if (is_array($rule)) {
103103
$rule = implode('|', $rule);
104104
}
105-
106105
$parameter = [
107106
'name' => $attribute,
108107
'description' => $rule,

0 commit comments

Comments
 (0)