Tag: openapi

允许swagger查询参数是string或整数的数组

在使用swagger2(openAPI)构buildrestapi时,我想允许查询参数station_id支持以下内容: station_id = 23(返回工作站23) station_id = 23,45(返回工作站23和45) ?station_id = [3:14](返回工作站3到14) ?station_id = 100%(%s充当通配符,因此返回像1001,10049等东西。) 我使用下面的swagger定义(string数组)作为尝试完成此操作: parameters: – name: station_id in: query description: filter stations by station_id required: false type: array items: type: string 有了这个定义,所有的前面的例子工作,除了station_id = 23作为swaggervalidation失败与以下消息: { "message": "Validation errors", "errors": [ { "code": "INVALID_REQUEST_PARAMETER", "errors": [ { "code": "INVALID_TYPE", "params": [ "array", "integer" ], "message": […]