apiaryio / fury-adapter-swagger

Swagger 2.0 parser adapter for Fury.js
MIT License
11 stars 12 forks source link

Handle parameter array types when enumeration is provided #119

Closed kylef closed 7 years ago

kylef commented 7 years ago

In Swagger a Parameter Object may contain enum which should match the same the parameter. For example, if I declare an array parameter which the items of the array would be strings. I would have an enumeration of arrays of strings which is permitted in specification. Any type MAY be inside the enum array [spec]:

Elements in the array MAY be of any type, including null.

While, I don't think it makes logical sense to do so. It is permitted in specification and I am seeing people do this in Swagger. Before this PR we was setting an elements content to an array which contained an array of primitive JavaScript types. Since an elements content can contain an array of elements, but not an array of primitive types the serialiser was failing for these documents. Correctly refracting the value would solve this problem.