postman-to-openapi icon indicating copy to clipboard operation
postman-to-openapi copied to clipboard

feature: transformation for array in the response

Open sarajcarbajal opened this issue 3 years ago • 1 comments

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: [email protected]
                example-1:
                  summary: GET /students (no students)
                  value: []

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

Thanks

sarajcarbajal avatar Mar 22 '22 16:03 sarajcarbajal

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

joolfe avatar Mar 31 '22 19:03 joolfe