Skip to content

Commit aa46f36

Browse files
committed
Add tags
1 parent 953d42d commit aa46f36

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

api.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,6 +3354,9 @@ public function build(): OpenApiDefinition
33543354
foreach ($tableNames as $tableName) {
33553355
$this->setComponentSchema("components|schemas", $tableName);
33563356
}
3357+
foreach ($tableNames as $index => $tableName) {
3358+
$this->setTag("tags", $index, $tableName);
3359+
}
33573360
return $this->openapi;
33583361
}
33593362

@@ -3386,6 +3389,12 @@ private function setComponentSchema(String $prefix, String $tableName) /*: void*
33863389
$this->openapi->set("$prefix|$tableName|properties|$columnName|type", $type);
33873390
}
33883391
}
3392+
3393+
private function setTag(String $prefix, int $index, String $tableName) /*: void*/
3394+
{
3395+
$this->openapi->set("$prefix|$index|name", "$tableName");
3396+
$this->openapi->set("$prefix|$index|description", "$tableName operations");
3397+
}
33893398
}
33903399

33913400
// file: src/Tqdev/PhpCrudApi/OpenApi/OpenApiDefinition.php

src/Tqdev/PhpCrudApi/OpenApi/OpenApiBuilder.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public function build(): OpenApiDefinition
4343
foreach ($tableNames as $tableName) {
4444
$this->setComponentSchema("components|schemas", $tableName);
4545
}
46+
foreach ($tableNames as $index => $tableName) {
47+
$this->setTag("tags", $index, $tableName);
48+
}
4649
return $this->openapi;
4750
}
4851

@@ -75,4 +78,10 @@ private function setComponentSchema(String $prefix, String $tableName) /*: void*
7578
$this->openapi->set("$prefix|$tableName|properties|$columnName|type", $type);
7679
}
7780
}
81+
82+
private function setTag(String $prefix, int $index, String $tableName) /*: void*/
83+
{
84+
$this->openapi->set("$prefix|$index|name", "$tableName");
85+
$this->openapi->set("$prefix|$index|description", "$tableName operations");
86+
}
7887
}

0 commit comments

Comments
 (0)