swagger-express-middleware
swagger-express-middleware copied to clipboard
Swagger 2.0 middlware and mocks for Express.js
Fixes #44
The parseRequest middleware does not allow empty arrays for specified parameters (e.g. `/foo?username=`), even when such a parameter's schema includes `required: false` and/or `minItems: 0`. ``` Error: The "username" query...
I'd like to see a new middleware added to handle non-CORS `OPTIONS` requests by responding `200 OK` with an `Allow` response header detailing which HTTP methods are supported for that...
How can I respond with proper JSON containing validator errors? I'm using parseRequest middleware, the error I'm catching has proper status property for validation errors (400), but when I'm about...
[Resource](https://github.com/BigstickCarpet/swagger-express-middleware/blob/3f8fc1a/lib/data-store/resource.js#L35) only depends on the [request path](https://github.com/BigstickCarpet/swagger-express-middleware/blob/e46e6a6/lib/mock/query-resource.js#L23) and even though the response is [picked by status code](https://github.com/BigstickCarpet/swagger-express-middleware/blob/3f8fc1a/lib/mock/index.js#L61), the status code is not taken into account when retrieving the response body...
I still have to figure out why I couldn't make it work for me, but this at least fixes the example.
I was having trouble getting api-docs to work on my prototype, so I tried it out. With a fresh clone, all tests pass, then I run npm start. When I...
There are [three types of mock responses](https://github.com/winniehell-forks/swagger-express-middleware/blob/3f8fc1aea0c431ebb815d255e2133e164d022910/lib/mock/index.js#L205-L218): - `object`, `array`, `undefined` - `file` - the rest Namely "the rest" according to [swagger specification](http://swagger.io/specification/#schemaObject) are all primitive types allowed by [JSON...
- removed tests with using strings and dates in fields minimum/maximum - changed mechanism of "no required" (from "schema.required = [];" to "delete schema.required;") - delete schema.required if we copy...
We have a simple mock server implementation based on swagger-express-middleware: ``` javascript var myDB = new FileDataStore('.rest-db'); var definitionsPath = 'src/swagger/specifications'; app.use(express.static('www')); fs.readdir(definitionsPath).forEach(function(filename){ console.log("Setting up mock services for "+definitionsPath+'/'+filename); middleware(definitionsPath+'/'+filename,app,...