File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 66
66
'license ' => 'Apache 2.0 ' ,
67
67
'license_url ' => 'https://www.apache.org/licenses/LICENSE-2.0.html ' ,
68
68
'server_url ' => env ('APP_URL ' , 'http://localhost ' ),
69
-
69
+ //openapi 3.0.x doesn't support request body for develop operation
70
+ //ref: https://github.com/OAI/OpenAPI-Specification/pull/2117
71
+ 'include_body_on_delete ' => false ,
70
72
// for now putting default responses for all. This can be changed later based on specific needs
71
73
'responses ' => [
72
74
'200 ' => [
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public function openApi(array $docs): LaravelRequestDocsToOpenApi
33
33
private function docsToOpenApi (array $ docs ): void
34
34
{
35
35
$ this ->openApi ['paths ' ] = [];
36
- // dd($ docs);
36
+ $ includeBodyForDelete = config ( ' request- docs.open_api.include_body_on_delete ' );
37
37
foreach ($ docs as $ doc ) {
38
38
$ requestHasFile = false ;
39
39
$ httpMethod = strtolower ($ doc ->getHttpMethod ());
@@ -66,7 +66,7 @@ private function docsToOpenApi(array $docs): void
66
66
67
67
$ contentType = $ requestHasFile ? 'multipart/form-data ' : 'application/json ' ;
68
68
69
- if ($ isPost || $ isPut || $ isDelete ) {
69
+ if ($ isPost || $ isPut || ( $ isDelete && $ includeBodyForDelete ) ) {
70
70
$ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['requestBody ' ] = $ this ->makeRequestBodyItem ($ contentType );
71
71
}
72
72
@@ -76,7 +76,7 @@ private function docsToOpenApi(array $docs): void
76
76
$ parameter = $ this ->makeQueryParameterItem ($ attribute , $ rule );
77
77
$ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['parameters ' ][] = $ parameter ;
78
78
}
79
- if ($ isPost || $ isPut || $ isDelete ) {
79
+ if ($ isPost || $ isPut || ( $ isDelete && $ includeBodyForDelete ) ) {
80
80
$ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['requestBody ' ]['content ' ][$ contentType ]['schema ' ]['properties ' ][$ attribute ] = $ this ->makeRequestBodyContentPropertyItem ($ rule );
81
81
}
82
82
}
You can’t perform that action at this time.
0 commit comments