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 code generation. The API can be found here:
https://app.swaggerhub.com/api/myaccount/BNA_Temp/v1
Two questions:
First, can you help find out what's wrong?
Second, are there any tools or techniques that I can use to track down this kind of issue myself?
Thanks for any help.
David
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.