@@ -3359,6 +3359,7 @@ public function build(): OpenApiDefinition
33593359 foreach ($ tableNames as $ tableName ) {
33603360 $ this ->setComponentSchema ($ tableName );
33613361 }
3362+ $ this ->setComponentParameters ();
33623363 foreach ($ tableNames as $ index => $ tableName ) {
33633364 $ this ->setTag ($ index , $ tableName );
33643365 }
@@ -3378,10 +3379,7 @@ private function setPath(String $tableName) /*: void*/
33783379 continue ;
33793380 }
33803381 $ path = sprintf ('/records/%s/{%s} ' , $ tableName , $ pkName );
3381- $ this ->openapi ->set ("paths| $ path| $ method|parameters|0|name " , "id " );
3382- $ this ->openapi ->set ("paths| $ path| $ method|parameters|0|in " , "path " );
3383- $ this ->openapi ->set ("paths| $ path| $ method|parameters|0|schema|type " , "string " );
3384- $ this ->openapi ->set ("paths| $ path| $ method|parameters|0|required " , true );
3382+ $ this ->openapi ->set ("paths| $ path| $ method|parameters|0| \$ref " , "#/components/parameters/pk " );
33853383 }
33863384 $ this ->openapi ->set ("paths| $ path| $ method|tags|0 " , "$ tableName " );
33873385 $ this ->openapi ->set ("paths| $ path| $ method|description " , "$ operation $ tableName " );
@@ -3403,6 +3401,15 @@ private function setComponentSchema(String $tableName) /*: void*/
34033401 }
34043402 }
34053403
3404+ private function setComponentParameters () /*: void*/
3405+ {
3406+ $ this ->openapi ->set ("components|parameters|pk|name " , "id " );
3407+ $ this ->openapi ->set ("components|parameters|pk|in " , "path " );
3408+ $ this ->openapi ->set ("components|parameters|pk|schema|type " , "string " );
3409+ $ this ->openapi ->set ("components|parameters|pk|description " , "primary key value " );
3410+ $ this ->openapi ->set ("components|parameters|pk|required " , true );
3411+ }
3412+
34063413 private function setTag (int $ index , String $ tableName ) /*: void*/
34073414 {
34083415 $ this ->openapi ->set ("tags| $ index|name " , "$ tableName " );
0 commit comments