Skip to content

Commit

Permalink
setting required property
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Nov 28, 2023
1 parent 6955854 commit eed2ece
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ protected function guessRecursive(string $class, array &$parameters, Operation $
$parameter->name = $parent ? $parent.'[' : '';
$parameter->name .= $propertyReflector->getName();
$parameter->name .= $parent ? ']' : '';
$parameter->parameter = $parameter->name;
}

if ($propertyReflector->isDefault()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
class GetResourcesPage
{
#[Param]
public int $offset = 0;
public ?int $offset = 0;

#[Param]
public int $limit = 10;
public ?int $limit = 10;
}
6 changes: 4 additions & 2 deletions tests/Functional/App/GetResourcesAction/Output/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@
"operationId": "54dc66cace0345df01577de4f43a2910",
"parameters": [
{
"parameter": "sort",
"name": "sort",
"in": "query"
},
{
"parameter": "page[offset]",
"name": "page[offset]",
"in": "query",
"required": true,
"example": 0
},
{
"parameter": "page[limit]",
"name": "page[limit]",
"in": "query",
"required": true,
"example": 10
},
{
"parameter": "filter[name]",
"name": "filter[name]",
"in": "query"
}
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/App/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ framework:
cookie_samesite: lax
php_errors:
log: true
throw: true

openapi:
default_path: '%kernel.project_dir%/%kernel.test_case%/'
Expand Down

0 comments on commit eed2ece

Please sign in to comment.