portman icon indicating copy to clipboard operation
portman copied to clipboard

Postman CollectionTypeError on empty examples object

Open miriamgreis opened this issue 5 months ago • 11 comments

If I use the following stripped-down OpenAPI file, I get an error during the conversion saying: Converting OpenAPI to Postman Collection Type Error: Cannot read properties of undefined (reading '$ref').

The problem is the empty examples: {} which is sometimes autogenerated by Stoplight Studio. This wasn't a problem with earlier versions of Portman, so I assume that it is related to some recent openapi-format updates. I'm not sure whether this can be fixed here, but for me it's most important that Portman fails on such errors when I use it in the CI. Otherwise, nobody will realise that the tests are not generated at all.

openapi: 3.0.1
info:
  title: Test
  version: 1.0.0
  description: Test
servers:
  - url: https://example.de/test
security:
  - bearerToken: []
tags:
  - name: Test API
paths:
  /test:
    get:
      summary: Get test
      tags:
        - Test API
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  test-value:
                    type: string
              examples: {}
      operationId: get-test
      description: Test
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer

miriamgreis avatar Sep 09 '24 09:09 miriamgreis