Skip to content

Commit

Permalink
Adds default schema type to OpenApiSearch query parameters (#474)
Browse files Browse the repository at this point in the history
* Adds default schema type to OpenApiSearch query parameters
  • Loading branch information
cnizzardini authored Oct 2, 2022
1 parent 4166b9d commit 45cbd74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Lib/Extension/CakeSearch/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ private function createParameter(FilterDecorator $filter): Parameter
{
$parameter = new Parameter(in: 'query', name: $filter->getName());
$parameter->setSchema(
(new Schema())->setDescription($filter->getComparison())
(new Schema())
->setDescription($filter->getComparison())
->setType('string')
);

return $parameter;
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/Lib/Extension/CakeSearch/ExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function test_search_parameters_exist_in_openapi_output(string $endpoint)
$search = $arr['paths'][$endpoint]['get'];

$this->assertEquals('first_name', $search['parameters'][0]['name']);
$this->assertEquals('string', $search['parameters'][0]['schema']['type']);
}

public function test_getOperation_throws_exception_when_event_subject_is_invalid(): void
Expand Down

0 comments on commit 45cbd74

Please sign in to comment.