Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ordering paramter to openApiPaginator #564

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions assets/x-swagger-bake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ x-swagger-bake:
required: false
schema:
type: integer
paginatorOrder:
name: order
in: query
required: false
schema:
type: array
items:
type: object
properties:
field:
type: string
example: name
dir:
type: string
example: asc
paginatorSort:
name: sort
in: query
Expand Down
1 change: 1 addition & 0 deletions src/Lib/Operation/OperationQueryParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private function definePagination(): void
$this->operation->pushRefParameter('#/x-swagger-bake/components/parameters/paginatorPage');
$this->operation->pushRefParameter('#/x-swagger-bake/components/parameters/paginatorLimit');
$this->pushSortParameter($paginator);
$this->operation->pushRefParameter('#/x-swagger-bake/components/parameters/paginatorOrder');
$this->operation->pushRefParameter('#/x-swagger-bake/components/parameters/paginatorDirection');
}

Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Lib/Operation/OperationQueryParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ public function test_all_attributes_in_one(): void
$operation = $operationQueryParam->getOperationWithQueryParameters();

$parameters = $operation->getParameters();

$this->assertCount(11, $parameters);
$this->assertCount(12, $parameters);
}

public function test_openapi_paginator(): void
Expand Down