swagger-api / validator-badge

Validate your Swagger JSON/YAML today!
http://swagger.io
Apache License 2.0
210 stars 85 forks source link

Empty parameter list #11

Closed wing328 closed 9 years ago

wing328 commented 9 years ago

The Swagger validator badge in http://petstore.swagger.io/ shows that http://petstore.swagger.io/v2/swagger.json is invalid.

[
{
level: "error",
domain: "validation",
keyword: "minItems",
message: "array is too short: must have at least 1 elements but instance has 0 elements",
schema: {
loadingURI: "http://swagger.io/v2/schema.json#",
pointer: "/definitions/parametersList"
},
instance: {
pointer: "/paths/~1store~1inventory/get/parameters"
}
}
]

Seems like it's due to /store/inventory with empty parameter list

parameters: [ ],

Does it mean Swagger Spec 2.0 does not allow empty "parameters"? If a method (endpoint) does not need any parameters in the request, should it completely omit "parameters" in the specification (json) ?

fehguy commented 9 years ago

It does allow empty arrays for parameters, this is a bug in the json schema that @webron is going to fix.

webron commented 9 years ago

This is fixed now.

wing328 commented 9 years ago

Thanks @webron