Forum Discussion

djs's avatar
djs
Occasional Contributor
8 years ago

Malformed or unreadable swagger supplied

My API definition passes validation in the editor and I can't see anything obviously wrong with it.  However, there's a big red "Invalid" message at the top of the page and it prevents me from doing ...
  • RonRatovsky's avatar
    8 years ago

    Hi David,

     

    The issue is that in multiple places, when you define an array, you set the `items` value as an array as well, where it should be an object. While JSON Schema does support both, the Swagger spec only allows for objects as values.

     

    For example,

     

      RecommendationsResponse:
        type: array
        items:
          - $ref: '#/definitions/Recommendation'

    Should be:

      RecommendationsResponse:
        type: array
        items:
          $ref: '#/definitions/Recommendation'

    Once you make all those modifications, it should work as expected.

     

    As for your second question - Since the spec uses a variant of JSON Schema, some issues are harder to track. We're constantly trying to improve our tools, and I'll open a ticket internally to address this specific issue.