@@ -33,6 +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
37
foreach ($ docs as $ doc ) {
37
38
$ requestHasFile = false ;
38
39
$ httpMethod = strtolower ($ doc ->getHttpMethod ());
@@ -46,7 +47,7 @@ private function docsToOpenApi(array $docs): void
46
47
$ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['parameters ' ] = [];
47
48
48
49
foreach ($ doc ->getPathParameters () as $ parameter => $ rule ) {
49
- $ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['parameters ' ][] = $ this ->makeQueryParameterItem ($ parameter , $ rule );
50
+ $ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['parameters ' ][] = $ this ->makePathParameterItem ($ parameter , $ rule );
50
51
}
51
52
52
53
$ this ->openApi ['paths ' ][$ uriLeadingSlash ][$ httpMethod ]['responses ' ] = config ('request-docs.open_api.responses ' , []);
@@ -106,6 +107,24 @@ protected function makeQueryParameterItem(string $attribute, $rule): array
106
107
return $ parameter ;
107
108
}
108
109
110
+ protected function makePathParameterItem (string $ attribute , $ rule ): array
111
+ {
112
+ if (is_array ($ rule )) {
113
+ $ rule = implode ('| ' , $ rule );
114
+ }
115
+ $ parameter = [
116
+ 'name ' => $ attribute ,
117
+ 'description ' => $ rule ,
118
+ 'in ' => 'query ' ,
119
+ 'style ' => 'form ' ,
120
+ 'required ' => str_contains ($ rule , 'required ' ),
121
+ 'schema ' => [
122
+ 'type ' => $ this ->getAttributeType ($ rule ),
123
+ ],
124
+ ];
125
+ return $ parameter ;
126
+ }
127
+
109
128
protected function makeRequestBodyItem (string $ contentType ): array
110
129
{
111
130
$ requestBody = [
0 commit comments