2.4.1 • Published 5 years ago
node-swagger-middleware v2.4.1
node-swagger-middleware
Project on top of sway and swagger-combine to provide middleware for express request/response validate
Installation
yarn add node-swagger-middleware
Example Usage
Express Example App
const express = require("express")
const swaggerCombine = require("swagger-combine")
const {
createExpressMiddleware,
ValidationError
} = require("node-swagger-middleware")
createExpressApp = async () => {
const app = express()
const swaggerFile = await swaggerCombine(`${__dirname}/swagger/index.yml`)
app.use(express.json())
app.use(await createExpressMiddleware(swaggerFile))
app.use((err, req, res, next) => {
if (err instanceof ValidationError) {
res.status(400)
} else {
res.status(500)
}
res.send({
err
})
})
return app
}
TODO
Support default value, type casing on request parameters
2.4.1
5 years ago
2.4.0
5 years ago
2.3.3
5 years ago
2.3.2
5 years ago
2.3.1
5 years ago
2.3.0
5 years ago
2.2.2
5 years ago
2.1.1
5 years ago
2.1.0
5 years ago
2.0.2
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.0.0
5 years ago
0.5.1
5 years ago
0.5.0
5 years ago
0.4.2
5 years ago
0.4.1
5 years ago
0.4.0
5 years ago
0.3.2
5 years ago
0.3.1
5 years ago
0.3.0
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago