joolfe / postman-to-openapi

🛸 Convert postman collection to OpenAPI
MIT License
575 stars 99 forks source link

feature: transformation for array in the response #183

Open sarajcarbajal opened 2 years ago

sarajcarbajal commented 2 years ago

Hello!

I'm trying to convert a postman collection to an openapi file and I have seen the following mistake.

I have the following request/response:

image

The response body is an array but when I convert this collection to an openapi, I see the following code:

/students:
    get:
      tags:
        - default
      summary: GET /students
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
              examples:
                example-0:
                  summary: GET /students
                  value:
                    - id: 808508
                      name: test
                      studentNumber: 597928475
                      email: test.test@sngular.com
                example-1:
                  summary: GET /students (no students)
                  value: []

I think that the schema of this response should be of array type, right?

Thanks

joolfe commented 2 years ago

Hi @sarajcarbajal,

That's not supported by the library in this moment, only detect that the response is JSON and set object as type. Could be a feature request ;-)

Best regards