File tree Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -471,7 +471,7 @@ private function buildParameters(array $resource): ?array
471471 $ parameters [$ key ] = new $ cl (
472472 key: $ key ,
473473 required: $ this ->phpize ($ parameter , 'required ' , 'bool ' ),
474- schema: $ parameter ['schema ' ],
474+ schema: $ parameter ['schema ' ] ?? null ,
475475 openApi: ($ parameter ['openapi ' ] ?? null ) ? new Parameter (
476476 name: $ parameter ['openapi ' ]['name ' ],
477477 in: $ parameter ['in ' ] ?? 'query ' ,
Original file line number Diff line number Diff line change @@ -533,8 +533,14 @@ private function buildParameters(\SimpleXMLElement $resource, ?array $values = n
533533 $ childNode = $ node ->addChild ('parameter ' );
534534 $ childNode ->addAttribute ('in ' , 'query ' );
535535 $ childNode ->addAttribute ('key ' , $ key );
536- $ childNode ->addAttribute ('required ' , $ this ->parse ($ value ['required ' ]));
537- $ this ->buildValues ($ childNode ->addChild ('schema ' ), $ value ['schema ' ]);
536+
537+ if (\array_key_exists ('required ' , $ value )) {
538+ $ childNode ->addAttribute ('required ' , $ this ->parse ($ value ['required ' ]));
539+ }
540+
541+ if (\array_key_exists ('schema ' , $ value )) {
542+ $ this ->buildValues ($ childNode ->addChild ('schema ' ), $ value ['schema ' ]);
543+ }
538544 }
539545 }
540546
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -139,6 +139,9 @@ resources:
139139 -
140140 rel : ' http://www.w3.org/ns/json-ld#error'
141141 href : ' http://www.w3.org/ns/hydra/error'
142+ parameters :
143+ date :
144+ key : date
142145 formats :
143146 json : null
144147 jsonld : null
Original file line number Diff line number Diff line change @@ -442,6 +442,9 @@ final class ResourceMetadataCompatibilityTest extends TestCase
442442 'links ' => [
443443 ['rel ' => 'http://www.w3.org/ns/json-ld#error ' , 'href ' => 'http://www.w3.org/ns/hydra/error ' ],
444444 ],
445+ 'parameters ' => [
446+ 'date ' => ['key ' => 'date ' ],
447+ ],
445448 ],
446449 ],
447450 ],
@@ -761,7 +764,7 @@ private function withParameters(array $values): ?array
761764
762765 $ parameters = [];
763766 foreach ($ values as $ k => $ value ) {
764- $ parameters [$ k ] = new QueryParameter (key: $ value ['key ' ], required: $ value ['required ' ], schema: $ value ['schema ' ]);
767+ $ parameters [$ k ] = new QueryParameter (key: $ value ['key ' ] ?? $ k , required: $ value ['required ' ] ?? null , schema: $ value ['schema ' ] ?? null );
765768 }
766769
767770 return $ parameters ;
You can’t perform that action at this time.
0 commit comments