Forum Discussion

AleMors85's avatar
AleMors85
New Member
2 years ago

Pagination with swagger 3 and open api 3

Hello!!

A pleasure to be here i nthis community!!

A question, hwo can I implement a pagination in swagger with open api 3 code generation? I am using a gradle task to generate my model objs.

In my GET call I'd need to return a 

SimplePage<BespokeObj>

with the pagination..is this possible using swagger yaml? 

1 Reply

  • do you mean: communicate pagination to the back-end ?

     

     

    so using parameters:

     

    parameters:

    page:
    name: page
    description: The page number of items to start with (see limit)
    in: query
    required: true
    schema:
    type: integer
    minimum: 1
    default: 1
    example: 1

    limit:
    name: limit
    description: The number of items to return
    in: query
    required: true
    schema:
    type: integer
    format: int32
    minimum: 1
    maximum: 225
    default: 25
    example: 25