File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,11 +144,13 @@ protected function parseInputField($definition)
144144
145145 list ($ _ , $ schema ) = $ this ->parseField ($ definition );
146146
147- return [
147+ $ result = [
148148 'in ' => $ fetcher ,
149- 'required ' => $ required ,
150149 'schema ' => $ schema ,
151150 ];
151+ if ($ required ) {
152+ $ result ['required ' ] = $ required ;
153+ }
152154 }
153155
154156 private function isNullable (string $ definition ): bool
@@ -197,10 +199,9 @@ protected function parseObject($definition)
197199 $ schema = [
198200 'type ' => 'object ' ,
199201 'properties ' => $ properties ,
200- 'required ' => $ requiredFields ,
201202 ];
202- if (empty ( $ schema [ ' required ' ]) ) {
203- unset( $ schema ['required ' ]) ;
203+ if ($ requiredFields ) {
204+ $ schema ['required ' ] = $ requiredFields ;
204205 }
205206
206207 if ($ this ->mode & self ::MODE_REF_SCHEMA ) {
@@ -293,10 +294,6 @@ protected function parseMap(string $definition): array
293294 $ schema ['example ' ] = $ example ;
294295 }
295296
296- if (empty ($ schema ['required ' ])) {
297- unset($ schema ['required ' ]);
298- }
299-
300297 $ definitionName = $ definition ::name ();
301298 if ($ this ->mode & self ::MODE_REF_SCHEMA ) {
302299 $ this ->schemas [$ definitionName ] = $ schema ;
You can’t perform that action at this time.
0 commit comments