6.46.8 • Published 19 hours ago

@gasket/plugin-swagger v6.46.8

Weekly downloads
16
License
MIT
Repository
github
Last release
19 hours ago

@gasket/plugin-swagger

Gasket plugin for working with Swagger specs, and uses swagger-ui-express to serve Swagger UI docs.

Installation

New apps

Recommended

gasket create <app-name> --plugins @gasket/plugin-swagger

Existing apps

npm i @gasket/plugin-swagger

Modify plugins section of your gasket.config.js:

module.exports = {
  plugins: {
    add: [
+      '@gasket/plugin-swagger'
    ]
  }
}

Configuration

  • swagger - (object) The base gasket.config object.
    • definitionFile - (string) Target swagger spec file, either json or yaml. (Default: 'swagger.json')
    • apiDocsRoute - (string) Route to Swagger UI (Default: '/api-docs')
    • jsdoc - (object) If set, the definitionFile will be generated based on JSDocs in the configured files. See the swagger-jsdocs options for what is supported.
    • ui - (object) Optional custom UI options. See swagger-ui-express options for what is supported.

Example from JSDocs

By specifying the swagger.jsdocs options in the gasket.config.js, the Swagger definition file will be generated with gasket build. It can be output to either a JSON (default) or YAML file.

// gasket.config.js

module.exports = {
  swagger: {
    jsdoc: {
      definition: {
        openapi: '3.0.0',           // Specification (optional, defaults to swagger: '2.0')
        info: {
          title: 'Theme API',       // Title (required)
          version: '1.0.0'          // Version (required)
        }
      },
      apis: ['api.js'] // Glob path to API Docs
    },
    definitionFile: 'swagger.json', // Default
    apiDocs: '/api-docs'            // Default
  }
}

Example from YAML

In this example, the Swagger spec will not be generated, but rather demonstrates how it can be hand-crafted via YAML file.

// gasket.config.js

module.exports = {
  swagger: {
    definitionFile: 'swagger.yaml'
  }
}

License

MIT

7.0.0-next.5

19 hours ago

6.46.8

2 days ago

7.0.0-next.4

3 days ago

7.0.0-next.3

7 days ago

7.0.0-next.2

14 days ago

7.0.0-next.1

15 days ago

7.0.0-next.0

15 days ago

6.46.7

24 days ago

7.0.0-cli.7

1 month ago

7.0.0-cli.6

1 month ago

6.46.1-cli.0

2 months ago

7.0.0-cli.5

2 months ago

7.0.0-cli.4

2 months ago

7.0.0-cli.1

2 months ago

7.0.0-cli.0

2 months ago

7.0.0-cli.3

2 months ago

7.0.0-cli.2

2 months ago

6.46.3-cli.0

2 months ago

6.46.2

2 months ago

7.0.0-canary.1

2 months ago

6.46.2-esm.0

2 months ago

6.45.2

3 months ago

6.45.0

3 months ago

6.43.0

7 months ago

6.39.3

11 months ago

6.39.0

11 months ago

6.38.8

11 months ago

6.38.5

1 year ago

6.38.1

1 year ago

6.36.1

1 year ago

6.38.0

1 year ago

6.34.6

2 years ago

6.36.0

1 year ago

6.34.3

2 years ago

6.34.4

2 years ago

6.34.2

2 years ago

6.26.1

2 years ago

6.31.0

2 years ago

6.28.0

2 years ago

6.21.0

2 years ago

6.24.2

2 years ago

6.24.0

2 years ago

6.20.4

2 years ago

6.20.3

2 years ago

6.20.2

2 years ago

6.19.0

2 years ago

6.10.1

2 years ago

6.10.0

2 years ago

6.14.0

2 years ago

6.11.2

2 years ago

6.17.0

2 years ago

6.15.2

2 years ago

6.7.0

3 years ago

6.0.12

3 years ago

6.0.0

3 years ago

6.0.0-canary.13

3 years ago

6.0.0-canary.9

3 years ago

5.10.0

3 years ago

6.0.0-canary.2

4 years ago

5.9.0

4 years ago

5.8.0

4 years ago