Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrleebo/swagger-restify-validation
A middleware extension for swagger-tools that integrates with node-restify-validations
https://github.com/mrleebo/swagger-restify-validation
Last synced: 26 days ago
JSON representation
A middleware extension for swagger-tools that integrates with node-restify-validations
- Host: GitHub
- URL: https://github.com/mrleebo/swagger-restify-validation
- Owner: MrLeebo
- License: mit
- Created: 2015-02-05T00:10:05.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-05T01:29:01.000Z (almost 10 years ago)
- Last Synced: 2024-12-15T19:55:56.077Z (27 days ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swagger-restify-validation
A middleware extension for swagger-tools that integrates with node-restify-validations
## Install
```
npm install swagger-restify-validation --save
```## Usage
Require swagger-restify validation,
```
var restifyValidation = require('swagger-restify-validation');
```Then include the middleware in your initializeMiddleware callback.
```
swaggerTools.initializeMiddleware(swaggerDoc, function(middleware) {
app.use(middleware.swaggerMetadata());
app.use(restifyValidation());// snip...
});
```You can now use `x-restify-validation` on your Swagger Operation objects to specify your node-restify-validation rules.
```
swagger: "2.0",
paths: {
"/api/resource": {
get: {
operationId: "resource",
parameters: [
{name: "str", type: "string", in: "query"}
]
"x-restify-validation": {
str: {
isAlpha: true
}
}
}
}
}```