All Projects → APIDevTools → Swagger Express Middleware

APIDevTools / Swagger Express Middleware

Licence: mit
Swagger 2.0 middlware and mocks for Express.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Swagger Express Middleware

Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+534.99%)
Mutual labels:  rest-api, swagger, openapi, server
Express Openapi Validator
🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
Stars: ✭ 436 (-19.71%)
Mutual labels:  rest-api, openapi, middleware, expressjs
Iris
The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |
Stars: ✭ 21,587 (+3875.51%)
Mutual labels:  middleware, expressjs, server
Openapi Directory
🌐 Wikipedia for Web APIs. Directory of REST API definitions in OpenAPI 2.0/3.x format
Stars: ✭ 2,635 (+385.27%)
Mutual labels:  rest-api, swagger, openapi
Generator Express No Stress
🚂 A Yeoman generator for Express.js based 12-factor apps and apis
Stars: ✭ 534 (-1.66%)
Mutual labels:  swagger, openapi, expressjs
Proteus
Lean, mean, and incredibly fast JVM framework for web and microservice development.
Stars: ✭ 178 (-67.22%)
Mutual labels:  rest-api, swagger, openapi
Drf Yasg
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
Stars: ✭ 2,523 (+364.64%)
Mutual labels:  rest-api, swagger, openapi
Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+420.26%)
Mutual labels:  rest-api, swagger, openapi
Tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 1,941 (+257.46%)
Mutual labels:  rest-api, middleware, swagger
Generator Express No Stress Typescript
🚄 A Yeoman generator for Express.js based 12-factor apps and apis using Typescript
Stars: ✭ 297 (-45.3%)
Mutual labels:  swagger, openapi, expressjs
Safrs
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI
Stars: ✭ 255 (-53.04%)
Mutual labels:  rest-api, swagger, openapi
Awesome Openapi3
😎 A list of awesome projects related to OpenAPI 3.0.x, curated by the community
Stars: ✭ 469 (-13.63%)
Mutual labels:  swagger, openapi, server
Swagger meqa
Auto generate and run tests using swagger/OpenAPI spec, no coding needed
Stars: ✭ 151 (-72.19%)
Mutual labels:  rest-api, swagger, openapi
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+3818.78%)
Mutual labels:  rest-api, swagger, openapi
Gemini
Model Driven REST framework to automatically generate CRUD APIs
Stars: ✭ 138 (-74.59%)
Mutual labels:  rest-api, swagger, openapi
Mirakurun
A Modern DTV Tuner Server Service for ISDB.
Stars: ✭ 352 (-35.17%)
Mutual labels:  openapi, middleware, server
Flask Restplus Server Example
Real-life RESTful server example on Flask-RESTplus
Stars: ✭ 1,240 (+128.36%)
Mutual labels:  rest-api, swagger, openapi
Grpc Gateway
The gRPC-Gateway is a plugin of the Google protocol buffers compiler protoc. It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC. This server is generated according to the google.api.http annotations in your service definitions.
Stars: ✭ 12,223 (+2151.01%)
Mutual labels:  rest-api, swagger, openapi
Php Crud Api
Single file PHP script that adds a REST API to a SQL database
Stars: ✭ 2,904 (+434.81%)
Mutual labels:  rest-api, swagger, openapi
Pode
Pode is a Cross-Platform PowerShell web framework for creating REST APIs, Web Sites, and TCP/SMTP servers
Stars: ✭ 329 (-39.41%)
Mutual labels:  swagger, openapi, server

Swagger Express Middleware

Swagger 2.0 middleware and mocks for Express.js

Cross-Platform Compatibility Build Status

Coverage Status Tested on APIs.guru Dependencies

npm License Buy us a tree

Features

  • Supports Swagger 2.0 specs in JSON or YAML
    Swagger Express Middleware uses Swagger-Parser to parse, validate, and dereference Swagger files. You can even split your spec into multiple different files using $ref pointers.

  • Thoroughly tested
    Over 1,000 unit tests and integration tests with 100% code coverage. Tested on over 1,500 real-world APIs from Google, Microsoft, Facebook, Spotify, etc. All tests are run on Mac, Linux, and Windows using all LTS versions of Node.

  • Mock middleware
    Fully-functional mock implementations for every operation in your API, including data persistence, all with zero code! This is a great way to test-drive your API as you write it, or for quick demos and POCs. You can even extend the mock middleware with your own logic and data to fill in any gaps.

  • Metadata middleware
    Annotates each request with all the relevant information from the Swagger definition. The path, the operation, the parameters, the security requirements - they're all easily accessible at req.swagger.

  • Parse Request middleware
    Parses incoming requests and converts everything into the correct data types, according to your Swagger API definition.

  • Validate Request middleware
    Ensures that every request complies with your Swagger API definition, or returns the appropriate HTTP error codes if needed. Of course, you can catch any validation errors and handle them however you want.

  • CORS middleware
    Adds the appropriate CORS headers to each request and automatically responds to CORS preflight requests, all in compliance with your Swagger API definition.

  • Files middleware
    Serves the Swagger API file(s) in JSON or YAML format so they can be used with front-end tools like Swagger UI, Swagger Editor, and Postman.

Installation and Use

Install using npm.

npm install @apidevtools/swagger-express-middleware

Then use it in your Node.js script like this:

const express = require('express');
const createMiddleware = require('@apidevtools/swagger-express-middleware');

let app = express();

createMiddleware('PetStore.yaml', app, function(err, middleware) {
    // Add all the Swagger Express Middleware, or just the ones you need.
    // NOTE: Some of these accept optional options (omitted here for brevity)
    app.use(
        middleware.metadata(),
        middleware.CORS(),
        middleware.files(),
        middleware.parseRequest(),
        middleware.validateRequest(),
        middleware.mock()
    );

    app.listen(8000, function() {
        console.log('The PetStore sample is now running at http://localhost:8000');
    });
});

Samples & Walkthroughs

Swagger Express Middleware comes two samples that use the Swagger Pet Store API.

Sample 1

This sample demonstrates the most simplistic usage of Swagger Express Middleware. It simply creates a new Express Application and adds all of the Swagger middleware without changing any options, and without adding any custom middleware.

Sample 2

This sample demonstrates a few more advanced features of Swagger Express Middleware, such as setting a few options, initializing the mock data store, and adding custom middleware logic.

Contributing

I welcome any contributions, enhancements, and bug-fixes. Open an issue on GitHub and submit a pull request.

Building/Testing

To build/test the project locally on your computer:

  1. Clone this repo
    git clone https://github.com/APIDevTools/swagger-express-middleware.git

  2. Install dependencies
    npm install

  3. Run the tests
    npm test

  4. Run the sample app
    npm start

License

Swagger Express Middleware is 100% free and open-source, under the MIT license. Use it however you want.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Big Thanks To

Thanks to these awesome companies for their support of Open Source developers ❤

Travis CI SauceLabs Coveralls

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].