Skip to content

autodesk-forks/swagger-express

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

autodesk-forks-swagger-express

This package is a fork of apigee-127/swagger-express. The purpose of this fork is to update dependencies and continue to maintain the original package.

Would you like to contribute? Read our contribution guidelines.

License: MIT NodeJS with Gulp semver npm version contributors

📖 Resources

Getting started

You can install this fork via npm:

npm i autodesk-forks-swagger-express

The required folder structure (naming can be changed via config parameters):

- api
  -- controllers
  -- config
     - default.yaml
  -- swagger
     - swagger.yaml
  -- fittings

Sample for config/default.yaml:

# swagger configuration file

# values in the swagger hash are system configuration for swagger-node
swagger:

  fittingsDirs: [ api/fittings ]
  defaultPipe: null
  swaggerControllerPipe: swagger_controllers  # defines the standard processing pipe for controllers

  # values defined in the bagpipes key are the bagpipes pipes and fittings definitions
  # (see https://github.com/apigee-127/bagpipes)
  bagpipes:

    _router:
      name: swagger_router
      mockMode: false
      mockControllersDirs: [ api/mocks ]
      controllersDirs: [ api/controllers ]

    _swagger_validate:
      name: swagger_validator
      validateResponse: true

    # pipe for all swagger-node controllers
    swagger_controllers:
      - _swagger_validate
      - swagger_security
      - express_compatibility
      - _router

    # pipe to serve swagger file (endpoint is in swagger.yaml)
    swagger_raw:
      name: swagger_raw

# any other values in this file are just loaded into the config for application access...

Sample usage with express server:

const SwaggerExpress = require("autodesk-forks-swagger-express");
const request = require("supertest");
const express = require('express')();

SwaggerExpress.create({
    appRoot: './test/assets/project',
}, async (err, swaggerExpress) => {
    swaggerExpress.register(express); // now your express server will have all the defined paths and definitions
});```

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%