@@ -90,14 +90,25 @@ protected function processRoute(Route $route)
90
90
// return [];
91
91
// }
92
92
93
+ if ($ this ->config ['include_doc_comments ' ]) {
94
+ $ description = (new DocBlockProcessor )($ reflectionMethod );
95
+ }
96
+
93
97
$ data = [
94
98
'name ' => $ route ->uri (),
95
- 'request ' => $ this ->processRequest (
96
- $ method ,
97
- $ uri ,
98
- $ this ->config ['enable_formdata ' ] ? (new FormDataProcessor )->process ($ reflectionMethod ) : collect ()
99
+ 'request ' => array_merge (
100
+ $ this ->processRequest (
101
+ $ method ,
102
+ $ uri ,
103
+ $ this ->config ['enable_formdata ' ] ? (new FormDataProcessor )->process ($ reflectionMethod ) : collect ()
104
+ ),
105
+ ['description ' => $ description ?? '' ]
99
106
),
100
107
'response ' => [],
108
+
109
+ 'protocolProfileBehavior ' => [
110
+ 'disableBodyPruning ' => $ this ->config ['protocol_profile_behavior ' ]['disable_body_pruning ' ] ?? false ,
111
+ ],
101
112
];
102
113
103
114
if ($ this ->config ['structured ' ]) {
@@ -139,19 +150,26 @@ protected function processRequest(string $method, Stringable $uri, Collection $r
139
150
->all (),
140
151
],
141
152
])
142
- ->when ($ rules , function (Collection $ collection , Collection $ rules ) {
153
+ ->when ($ rules , function (Collection $ collection , Collection $ rules ) use ( $ method ) {
143
154
if ($ rules ->isEmpty ()) {
144
155
return $ collection ;
145
156
}
146
157
158
+ $ rules ->transform (fn ($ rule ) => [
159
+ 'key ' => $ rule ['name ' ],
160
+ 'value ' => $ this ->config ['formdata ' ][$ rule ['name ' ]] ?? null ,
161
+ 'description ' => $ this ->config ['print_rules ' ] ? $ this ->parseRulesIntoHumanReadable ($ rule ['name ' ], $ rule ['description ' ]) : null ,
162
+ ]);
163
+
164
+ if ($ method === 'GET ' ) {
165
+ return $ collection ->put ('url ' , [
166
+ 'query ' => $ rules ->map (fn ($ value ) => array_merge ($ value , ['disabled ' => false ]))
167
+ ]);
168
+ }
169
+
147
170
return $ collection ->put ('body ' , [
148
171
'mode ' => 'urlencoded ' ,
149
- 'urlencoded ' => $ rules ->map (fn ($ rule ) => [
150
- 'key ' => $ rule ['name ' ],
151
- 'value ' => $ this ->config ['formdata ' ][$ rule ['name ' ]] ?? null ,
152
- 'type ' => 'text ' ,
153
- 'description ' => $ this ->config ['print_rules ' ] ? $ this ->parseRulesIntoHumanReadable ($ rule ['name ' ], $ rule ['description ' ]) : null ,
154
- ]),
172
+ 'urlencoded ' => $ rules ->map (fn ($ value ) => array_merge ($ value , ['type ' => 'text ' ])),
155
173
]);
156
174
})
157
175
->all ();
0 commit comments