Skip to content

Commit 11db16c

Browse files
committed
Add path parameter support
1 parent 84d5760 commit 11db16c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

api.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3373,6 +3373,10 @@ private function setPath(String $prefix, String $tableName) /*: void*/
33733373
continue;
33743374
}
33753375
$path = sprintf('/records/%s/{%s}', $tableName, $pkName);
3376+
$this->openapi->set("$prefix|$path|$method|parameters|0|name", "id");
3377+
$this->openapi->set("$prefix|$path|$method|parameters|0|in", "path");
3378+
$this->openapi->set("$prefix|$path|$method|parameters|0|schema|type", "string");
3379+
$this->openapi->set("$prefix|$path|$method|parameters|0|required", true);
33763380
}
33773381
$this->openapi->set("$prefix|$path|$method|tags|0", "$tableName");
33783382
$this->openapi->set("$prefix|$path|$method|description", "$operation $tableName");
@@ -3409,7 +3413,7 @@ public function __construct($base)
34093413
$this->root = $base;
34103414
}
34113415

3412-
public function set(String $path, String $value) /*: void*/
3416+
public function set(String $path, $value) /*: void*/
34133417
{
34143418
$parts = explode('|', trim($path, '|'));
34153419
$current = &$this->root;

src/Tqdev/PhpCrudApi/OpenApi/OpenApiBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ private function setPath(String $prefix, String $tableName) /*: void*/
6262
continue;
6363
}
6464
$path = sprintf('/records/%s/{%s}', $tableName, $pkName);
65+
$this->openapi->set("$prefix|$path|$method|parameters|0|name", "id");
66+
$this->openapi->set("$prefix|$path|$method|parameters|0|in", "path");
67+
$this->openapi->set("$prefix|$path|$method|parameters|0|schema|type", "string");
68+
$this->openapi->set("$prefix|$path|$method|parameters|0|required", true);
6569
}
6670
$this->openapi->set("$prefix|$path|$method|tags|0", "$tableName");
6771
$this->openapi->set("$prefix|$path|$method|description", "$operation $tableName");

src/Tqdev/PhpCrudApi/OpenApi/OpenApiDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function __construct($base)
1010
$this->root = $base;
1111
}
1212

13-
public function set(String $path, String $value) /*: void*/
13+
public function set(String $path, $value) /*: void*/
1414
{
1515
$parts = explode('|', trim($path, '|'));
1616
$current = &$this->root;

0 commit comments

Comments
 (0)