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

Array parameters cause fatal errors when not using schemaFaker #64

Closed
brpeterman opened this issue May 24, 2019 · 0 comments · Fixed by #65
Closed

Array parameters cause fatal errors when not using schemaFaker #64

brpeterman opened this issue May 24, 2019 · 0 comments · Fixed by #65

Comments

@brpeterman
Copy link

openapi-to-postmanv2 version: 0.0.12

Example OpenAPI spec:

openapi: 3.0.1
info:
  title: Example API
  version: 1.0.0
paths:
  /operation:
    get:
      summary: Operation that accepts an array
      description: ''
      operationId: operation
      parameters:
        -
          in: query
          name: arrayInput
          schema:
            type: array
            items:
              type: string
      responses:
        default:
          description: Response

Invocation example:

const converter = require('openapi-to-postmanv2');
const fs = require('fs');

const specString = fs.readFileSync('resources/broken.yaml', { encoding: 'utf8' });
this._postman = converter.convert({
    type: 'string',
    data: specString
}, {
    schemaFaker: false
}, () => {});

Description of problem

When schemaFaker is disabled, openapi-to-postmanv2 produces this error for any operation that takes an array parameter that is not annotated with a specific array style:

TypeError: paramValue.join is not a function
    at Object.convertParamsWithStyle (/path/to/project/node_modules/openapi-to-postmanv2/lib/util.js:815:29)

Because schemaFaker is disabled, paramValue is an empty string. It looks like I would also run into this problem in different branches if I did specify an array style, so I don't think that will solve the problem.

I ran into this bug because the schema faker cannot handle recursive schemas and some of the schemas in my API are recursive (tree structures, mainly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant