@@ -8159,11 +8159,11 @@ class OpenApiBuilder
81598159 private $ records ;
81608160 private $ columns ;
81618161
8162- public function __construct (ReflectionService $ reflection , $ base )
8162+ public function __construct (ReflectionService $ reflection , array $ base, array $ controllers )
81638163 {
81648164 $ this ->openapi = new OpenApiDefinition ($ base );
8165- $ this ->records = new OpenApiRecordsBuilder ($ this ->openapi , $ reflection );
8166- $ this ->columns = new OpenApiColumnsBuilder ($ this ->openapi );
8165+ $ this ->records = in_array ( ' records ' , $ controllers ) ? new OpenApiRecordsBuilder ($ this ->openapi , $ reflection ) : null ;
8166+ $ this ->columns = in_array ( ' columns ' , $ controllers ) ? new OpenApiColumnsBuilder ($ this ->openapi ) : null ;
81678167 }
81688168
81698169 private function getServerUrl (): string
@@ -8182,8 +8182,12 @@ public function build(): OpenApiDefinition
81828182 if (!$ this ->openapi ->has ("servers " ) && isset ($ _SERVER ['REQUEST_URI ' ])) {
81838183 $ this ->openapi ->set ("servers|0|url " , $ this ->getServerUrl ());
81848184 }
8185- $ this ->records ->build ();
8186- //$this->columns->build();
8185+ if ($ this ->records ) {
8186+ $ this ->records ->build ();
8187+ }
8188+ if ($ this ->columns ) {
8189+ $ this ->columns ->build ();
8190+ }
81878191 return $ this ->openapi ;
81888192 }
81898193 }
@@ -8266,7 +8270,11 @@ private function setPaths() /*: void*/
82668270 $ this ->openapi ->set ("paths| $ path| $ method|requestBody| \$ref " , "#/components/requestBodies/ $ operationType " );
82678271 }
82688272 $ this ->openapi ->set ("paths| $ path| $ method|tags|0 " , "$ type " );
8269- $ this ->openapi ->set ("paths| $ path| $ method|description " , "$ operation $ type " );
8273+ if ($ operationType == 'updateTable ' ) {
8274+ $ this ->openapi ->set ("paths| $ path| $ method|description " , "rename table " );
8275+ } else {
8276+ $ this ->openapi ->set ("paths| $ path| $ method|description " , "$ operation $ type " );
8277+ }
82708278 switch ($ operation ) {
82718279 case 'read ' :
82728280 $ this ->openapi ->set ("paths| $ path| $ method|responses|200| \$ref " , "#/components/responses/ $ operationType " );
@@ -8294,15 +8302,23 @@ private function setComponentSchema() /*: void*/
82948302 switch ($ type ) {
82958303 case 'database ' :
82968304 $ this ->openapi ->set ("$ prefix|properties|tables|type " , 'array ' );
8297- $ this ->openapi ->set ("$ prefix|properties|tables|items| \$ref " , "#/components/responses /readTable " );
8305+ $ this ->openapi ->set ("$ prefix|properties|tables|items| \$ref " , "#/components/schemas /readTable " );
82988306 break ;
82998307 case 'table ' :
8300- $ this ->openapi ->set ("$ prefix|properties|name|type " , 'string ' );
8301- $ this ->openapi ->set ("$ prefix|properties|type|type " , 'string ' );
8302- $ this ->openapi ->set ("$ prefix|properties|columns|type " , 'array ' );
8303- $ this ->openapi ->set ("$ prefix|properties|columns|items| \$ref " , "#/components/responses/readColumn " );
8308+ if ($ operation == 'update ' ) {
8309+ $ this ->openapi ->set ("$ prefix|required " , ['name ' ]);
8310+ $ this ->openapi ->set ("$ prefix|properties|name|type " , 'string ' );
8311+ } else {
8312+ $ this ->openapi ->set ("$ prefix|properties|name|type " , 'string ' );
8313+ if ($ operation == 'read ' ) {
8314+ $ this ->openapi ->set ("$ prefix|properties|type|type " , 'string ' );
8315+ }
8316+ $ this ->openapi ->set ("$ prefix|properties|columns|type " , 'array ' );
8317+ $ this ->openapi ->set ("$ prefix|properties|columns|items| \$ref " , "#/components/schemas/readColumn " );
8318+ }
83048319 break ;
83058320 case 'column ' :
8321+ $ this ->openapi ->set ("$ prefix|required " , ['name ' , 'type ' ]);
83068322 $ this ->openapi ->set ("$ prefix|properties|name|type " , 'string ' );
83078323 $ this ->openapi ->set ("$ prefix|properties|type|type " , 'string ' );
83088324 $ this ->openapi ->set ("$ prefix|properties|length|type " , 'integer ' );
@@ -8378,7 +8394,7 @@ class OpenApiDefinition implements \JsonSerializable
83788394 {
83798395 private $ root ;
83808396
8381- public function __construct ($ base )
8397+ public function __construct (array $ base )
83828398 {
83838399 $ this ->root = $ base ;
83848400 }
@@ -8750,9 +8766,9 @@ class OpenApiService
87508766 {
87518767 private $ builder ;
87528768
8753- public function __construct (ReflectionService $ reflection , array $ base )
8769+ public function __construct (ReflectionService $ reflection , array $ base, array $ controllers )
87548770 {
8755- $ this ->builder = new OpenApiBuilder ($ reflection , $ base );
8771+ $ this ->builder = new OpenApiBuilder ($ reflection , $ base, $ controllers );
87568772 }
87578773
87588774 public function get (): OpenApiDefinition
@@ -10042,7 +10058,7 @@ public function __construct(Config $config)
1004210058 new CacheController ($ router , $ responder , $ cache );
1004310059 break ;
1004410060 case 'openapi ' :
10045- $ openApi = new OpenApiService ($ reflection , $ config ->getOpenApiBase ());
10061+ $ openApi = new OpenApiService ($ reflection , $ config ->getOpenApiBase (), $ config -> getControllers () );
1004610062 new OpenApiController ($ router , $ responder , $ openApi );
1004710063 break ;
1004810064 case 'geojson ' :
0 commit comments