Skip to content

Ambiguous error when loading from yaml example #149

@jcfrank

Description

@jcfrank

Hi,

This is probably not a pyswagger issue but I just want to report what I observe and maybe you can decide whether it is or not an issue.

Looking at the 'quick start' section, the sample code loads spec from

http://petstore.swagger.io/v2/swagger.json

My current project prefers YAML format, so naturally I tried letting pyswagger load from this alternative:

http://petstore.swagger.io/v2/swagger.yaml

Code:

app = pyswagger.App.load('http://petstore.swagger.io/v2/swagger.yaml')
app.prepare()

But then I got the following error when preforming prepare:

TypeError: 'int' object is not iterable

The json version can be prepared without problem, so I went on and compared their differences. The key issue was under paths section, responses part.

      responses:
        405:
          description: "Invalid input"
    "responses": {
      "405": {
        "description": "Invalid input"
      }
    },

In the YAML file the status codes were listed as numbers, but in JSON file they were strings. This will cause error even with strict set to False.

Adding double quotes in YAML solves the problem, but the file is from the same example source so there could be others like me, confused by this in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions