Closed pdipax closed 4 months ago
Sorry I don't clearly understand the issue here. can you be more specific and also provide an example, how you use it and the output.
sorry, this is my method:
/*
* @getListaApps
* @tag Apps
* @paramQuery page - Pagina da mostrare, se non indicata default sarà 1
* @paramQuery perPage - Elementi per pagina, se non indicato saranno 999999
* @responseBody 200 - <App[]>.paginated()
*/
async getListaApps({ request, params, response }:HttpContext) {
in /docs under responseBody I see this:
data: {
"codice": "string",
"nome": "string",
"descrizione": "string",
"visibile_agenti": true,
"permessi": [
{
"app": "$ref:/components/schemas/App",
"ruolo": [...
...
]
}, meta: {}
practically it is also inserting all the relations of the model into the response. finally, despite having set the paginated() response, the interface provided for the meta key is not populated but only an empty object.
Oooh... thx, that is indeed an issue. will look into that
Please help me solve this bug with the promise that later I will help you introduce the parser also for validators as I have read in other threads. It would be practically complete if you could also insert a sample requestbody based on the validator ;-)
I just made a pull request to also allow the model to declare the column name and type on the same line as @column first the parser assumed that the line had to start with "declare" but I replaced it with includes('declare')
Hey... thx for the PRs, I've merged and published them today in addition with the relations fix. Now, relations are not included by default. This used to work, but I messed something up later on.
However, I still cannot explain the missing meta. It works on my end.
* @responseBody 200 - <User[]>.paginated()
Hi, relations are also included by default in RequestBody. Could you fix this? Thanks
Hi, relations are also included by default in RequestBody. Could you fix this? Thanks
this is already fixed in the newest version
I update to last version 3.25.0 but this is not fixed Furthermore the newest feature @props doesn't work with required.
Finally I encounter the same error in the responsebody regarding pagination. Can you tell me that I don't need to create the interface but that it should be generated automatically?
I update to last version 3.25.0 but this is not fixed Furthermore the newest feature @props doesn't work with required.
Finally I encounter the same error in the responsebody regarding pagination. Can you tell me that I don't need to create the interface but that it should be generated automatically?
I just published a new version 3.26. Can you try it with that one. The pagination IF should get generated automatically.
Regarding relations... could you show me an example code and output, please?
Ok the last version doesn't work.
last version code:
...example_1.ExampleInterfaces.paginationInterface(),
work if fix this line as below;
...example_1.ExampleInterfaces.paginationInterface('PaginationMeta'),
Regarding relations I try this:
* @requestBody <App>
but I receive the full model with relations in scalar ui.
In responseBody if I set this
@responseBody 404 - Product could not be found
The description "Product could not be found" doens't appear
oooh... your getting the full model in request body... okey.. will have a look
regarding 404 can you try other ui like rapidoc?
For me everything works as expected
/**
* @store
* @requestBody <User>
* @responseBody 404 - Product not found
*/
async store({}: HttpContext) {
// ...
}
Ok with other ui. The issue is only in scalar ui.
Oooh and regarding the request and response body... scalar seems to use the model instead, which of course shows the relations, since it's a part of the model.
Scalar should show examples too, instead of models
If the pagination does not work, can you please open the "/swagger" url and see if it appears there
Should look something like this
schemas:
Any:
description: "Any JSON object not defined as schema"
PaginationMeta:
type: "object"
properties:
total:
type: "number"
example: 100
nullable: false
page:
type: "number"
example: 2
nullable: false
perPage:
type: "number"
example: 10
nullable: false
currentPage:
Closing this since it works but scalar doesn't respect the example
Hi, thanks for this work.
I installed the latest version of the package but it doesn't work in responseBody.paginated() because it correctly returns the schema in data and the meta effect but it is still empty, the pagination interface that I had read is missing, it no longer exists necessary. Furthermore, it doesn't work because is always returned with the relations even if .with is not indicated and if I use .with by specifying a relation, all of them are always returned anyway