-
Notifications
You must be signed in to change notification settings - Fork 22
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
Adding collection schema to methods that use openApiPaginator #563
Conversation
Hey there thanks for submitting a pull request. Do you mind adding a description? I''ll review this when I have time over the holidays. Thanks @MasaKni! |
@cnizzardini another thing. |
assets/x-swagger-bake.yaml
Outdated
@@ -14,6 +14,21 @@ x-swagger-bake: | |||
required: false | |||
schema: | |||
type: integer | |||
paginatorOrder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? How come paginatorSort
will not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paginatorSort
only works for one field sorting, if we want to sort by let's say name and date we can't do that with it we would use the order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pulled your branch in using the demo: https://github.com/cnizzardini/cakephp-swagger-bake-demo
How come I get output that looks like this on /actors/{id}/films
:
The only change I made here (https://github.com/cnizzardini/cakephp-swagger-bake-demo/blob/master/src/Controller/ActorsController.php#L155) was adding in #[OpenApiPaginator]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MasaKni bump ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes well we can agree on another structure for order, but i saw that adding it in this format will be helpful,
we can add ordering as object and each we add we specify the field and dir
if you try it then it will add objects of the
{ "field": "name", "dir": "asc" }
and we would wanna keep the sort because we wanna allow sorting by one field not a combination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can't resolve this in the current PR can we remove this for now and come back to it? I don't want to release something that doesn't work with SwaggerUI @MasaKni
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MasaKni is this resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MasaKni I am going to close this PR if you don't respond this.
Honestly, I am not sure. I am not as active in this library as I once was. Is it causing an issue or just seems off? |
yes it is adding the default content |
Can you post an issue for this with steps to reproduce and I can take a look at it? |
I'm a bit confused by this PR. I am looking at a private codebase I maintain (running cakephp 5.1 and swaggerbake 3.0.5 on php 8.3) and Given the following setup: #[OpenApiPaginator]
#[OpenApiSecurity(name: 'bearerAuth')]
public function bar() I get this output: /api/foo/bar:
get:
operationId: foo:bar:get
tags:
- Foo
parameters:
- $ref: '#/x-swagger-bake/components/parameters/paginatorPage'
- $ref: '#/x-swagger-bake/components/parameters/paginatorLimit'
- $ref: '#/x-swagger-bake/components/parameters/paginatorSort'
- $ref: '#/x-swagger-bake/components/parameters/paginatorDirection' |
@MasaKni My apologies, I see now what you a specifically solving for is the database schema portion not showing as the OpenAPI example schema, not the query parameters. |
yes indeed, the parameters are added correctly but the schema is set for the default response which is |
It is courtesy to note when you have resolved comments. |
Resolves #562
I modified the code so that actions that have the openApiPaginator will get the collection response, and i also added the schema to the action because it was not being set at all.
moved:
I also added the possibility to sort/order by an array which requires an array object in the swagger