Skip to content

Commit

Permalink
added optional param test
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed Jul 9, 2024
1 parent 097da8a commit 78cd830
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/Generator/Request/ParametersDocumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,17 @@ public function __invoke(Request $request)
it('supports optional parameters', function () {
$openApiDocument = generateForRoute(fn () => RouteFacade::get('api/test/{param?}', SupportOptionalParam_ParametersDocumentationTestController::class));

dd($openApiDocument);

expect($openApiDocument['paths']['/test']['get']['parameters'])
expect($openApiDocument['paths']['/test/{param}']['get']['parameters'])
->toHaveCount(1)
->and($openApiDocument['paths']['/test']['get']['parameters'][0])
->and($openApiDocument['paths']['/test/{param}']['get']['parameters'][0])
->toBe([
'name' => 'foo',
'in' => 'query',
'name' => 'param',
'in' => 'path',
'required' => true,
'description' => '**Optional**. The name of the person to greet',
'schema' => [
'type' => 'string',
'format' => 'uuid',
'type' => ['string', 'null'],
'default' => 'foo',
],
]);
});
Expand Down

0 comments on commit 78cd830

Please sign in to comment.