GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - danielgolub/openapi-middleware: Swagger 3.0 middleware for common api frameworks (pre-release version!)

BranchesTags
Open more actions menu

Latest commit

 

History

40 Commits
40 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
lib
lib
 
 
tests
tests
 
 
.coveralls.yml
.coveralls.yml
 
 
.eslintrc.yml
.eslintrc.yml
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
index.js
index.js
 
 
jsdoc.css
jsdoc.css
 
 
jsdoc.json
jsdoc.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Sequelize logo

openapi-middleware

This is a wrapper for express that turns an openapi 3.0 document into a working api server. It sets up the endpoints, validates inputs, outputs, authentication and more.

Node.js CI License: MIT Codacy Badge Codacy Badge contributors npm version JSDocs Automation Release Automation

⚠️ Important: WIP!

This is pre-release code that is not stable yet and does not fully meet open api 3.0 standards. You're more than welcome to contribute to this repo to increase the velocity of the development effort.

📖 Resources

  • Documentation
    • module:index
    • module:ExpressMiddleware
      • ExpressMiddleware.ConfigOptions
    • module:ParameterValidator
    • module:SecurityValidator
    • module:ResponseValidator
    • module:Endpoint
  • Changelog

💻 Getting Started

You can install this fork via npm:

npm i openapi-middleware

Sample usage with express:

import openapiMiddleware from 'openapi-middleware';
import express from 'express';
import bodyParser from 'body-parser';
import {resolve} from "path";

const config = {
  definition: resolve('./tests/helpers/openapi-sample-v3.yaml'),
  controllers: resolve('./tests/helpers/controllers'),
  securitySchemes: {
    basicAuth: (req, res, next) => {
      // sample security callback for basicAuth security scheme
      next();
    }
  },
  enforceResponseValidation: false,
};

const app = express();

new openapiMiddleware.ExpressMiddleware(config)
  .on('ready', (router) => {
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: true }));
    app.use(router);
    app.listen(2020, () => console.log('server is running!'));
  })
  .on('invalidResponse', (error) => {
    console.error('silently failed on invalid response', error);
  })
  .on('error', (error) => {
    console.error('startup error', error);
  });

About

Swagger 3.0 middleware for common api frameworks (pre-release version!)

Topics

apiexpressopenapiopenapi-3swagger

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.