Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import openapi 3.0 spec in postman #150

Closed
kapilratnani opened this issue Jan 5, 2020 · 0 comments · Fixed by #156
Closed

Cannot import openapi 3.0 spec in postman #150

kapilratnani opened this issue Jan 5, 2020 · 0 comments · Fixed by #156
Assignees
Labels
bug Something isn't working

Comments

@kapilratnani
Copy link

kapilratnani commented Jan 5, 2020

I've an openapi spec generated using Stoplight which i am not able to import in postman. I found out that Postman internally uses this library to convert openapi to postman representation.

Following error is obtained by using this library.

TypeError: Cannot read property 'hasOwnProperty' of undefined
    at Object.getExampleData (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:782:17)
    at Object.convertToPmBodyData (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:836:23)
    at Object.convertToPmResponseBody (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:718:25)
    at Object.convertToPmResponse (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1336:32)
    at _.forOwn (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1635:34)
    at /node_modules/openapi-to-postmanv2/node_modules/lodash/lodash.js:4905:15
    at baseForOwn (/node_modules/openapi-to-postmanv2/node_modules/lodash/lodash.js:2990:24)
    at Function.forOwn (/node_modules/openapi-to-postmanv2/node_modules/lodash/lodash.js:13014:24)
    at Object.convertRequestToItem (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1604:9)
    at Object.convertChildToItemGroup (/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:614:19)

It seems the issue is due to empty examples section which Stoplight produces.

  get:
      summary: Some API
      responses:
        '200':
          description: Some description
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
              examples: { }

I was able to import the spec after i removed the empty examples section.

Anyway it should work with empty examples section, hence a bug.

@umeshp7 umeshp7 self-assigned this Jan 6, 2020
@umeshp7 umeshp7 added the bug Something isn't working label Jan 6, 2020
@umeshp7 umeshp7 assigned umeshp7 and unassigned umeshp7 Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants