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

`TypeError: boolean true is not iterable (cannot read property Symbol(Symbol.iterator))` at 4.0.2

Open Charlie91 opened this issue 5 years ago • 5 comments

I have a problem on a last 4.0.2 version that I solved rolling back to 4.0.0.

TypeError: boolean true is not iterable (cannot read property Symbol(Symbol.iterator)).

The error also dissapears if I change property required in parameter of "type": "file" to false

swagger.json

{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "swagger": "2.0",
  "info": {
    "description": "API for Portal",
    "title": "Portal API",
    "version": "0.1.0"
  },
  "host": "portal.test",
  "basePath": "/api",
  "paths": {
    "/activity/transaction/{counterparty}/{transaction_number}/attachment": {
      "post": {
        "security": [
          {
            "Oauth": [
              "readaccount"
            ]
          }
        ],
        "consumes": [
          "multipart/form-data"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "activity_transaction_attachment"
        ],
        "summary": "Upload attachment for the transaction",
        "operationId": "postTransactionAttachment",
        "parameters": [
          {
            "type": "file",
            "description": "The file to upload",
            "name": "file",
            "required": true,
            "in": "formData"
          }
        ],
        "responses": {
          "200": {
            "description": "Success upload an attachment for the instruction"
          },
          "default": {
            "description": "Default error",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {},
  "securityDefinitions": {}
}

Charlie91 avatar Aug 18 '21 08:08 Charlie91

I just ran into this error as well. ~~Will give 4.0.1 a try.~~ Version 4.0.1 does not appear to be affected.

eirikur-grid avatar Aug 19 '21 13:08 eirikur-grid

Hm. I don’t think we know how to support "type": "file". Let me push a fix for that and see if that resolves it.

drwpow avatar Sep 30 '21 20:09 drwpow

I’m seeing an improvement to this in 4.1.0. Please give it a try and let me know if the problem is improved.

drwpow avatar Sep 30 '21 21:09 drwpow

Not the OP here, but I was hitting this issue in 4.0.2 today, found this issue while researching, and update to 4.1.0. For my use case the error has now gone away and the result is as expected. Thanks!

mmounts avatar Nov 02 '21 18:11 mmounts

I believe this is fixed in version 6 as well, closing...

mitchell-merry avatar Apr 09 '23 23:04 mitchell-merry