mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 01:18:37 +00:00
Only allow default values for optional params
This commit is contained in:
parent
73d0f033b8
commit
0471bf1c90
1 changed files with 10 additions and 8 deletions
|
|
@ -133,21 +133,23 @@ class SchemaBuilder
|
|||
$params = [];
|
||||
$list = false;
|
||||
|
||||
foreach ($route->getParams() as $key => $value) {
|
||||
if ($key === 'queries') {
|
||||
foreach ($route->getParams() as $name => $parameter) {
|
||||
if ($name === 'queries') {
|
||||
$list = true;
|
||||
}
|
||||
$argType = TypeMapper::fromRouteParameter(
|
||||
$utopia,
|
||||
$value['validator'],
|
||||
!$value['optional'],
|
||||
$value['injections']
|
||||
$parameter['validator'],
|
||||
!$parameter['optional'],
|
||||
$parameter['injections']
|
||||
);
|
||||
$params[$key] = [
|
||||
$params[$name] = [
|
||||
'type' => $argType,
|
||||
'description' => $value['description'],
|
||||
'defaultValue' => $value['default']
|
||||
'description' => $parameter['description'],
|
||||
];
|
||||
if ($parameter['optional']) {
|
||||
$params[$name]['defaultValue'] = $parameter['default'];
|
||||
}
|
||||
}
|
||||
|
||||
$field = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue