7.0.6 • Published 8 months ago

@gasket/plugin-swagger v7.0.6

Weekly downloads
16
License
MIT
Repository
github
Last release
8 months ago

@gasket/plugin-swagger

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

Installation

npm i @gasket/plugin-swagger

Update your gasket file plugin configuration:

// gasket.js

+ import pluginSwagger from '@gasket/plugin-swagger';

export default makeGasket({
  plugins: [
+   pluginSwagger
  ]
});

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.
    • uiConfig - (object) Optional custom UI options. Only for use with Fastify. See @fastify/swagger-ui options for what is supported.

Example from JSDocs

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

// gasket.js

export default makeGasket({
  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.js

export default makeGasket({
  swagger: {
    definitionFile: 'swagger.yaml'
  }
});

License

MIT

7.0.6

8 months ago

7.0.0

9 months ago

7.0.1

9 months ago

6.47.4

9 months ago

6.47.5

9 months ago

7.0.0-next.69

9 months ago

7.0.0-next.70

9 months ago

7.0.0-next.67

10 months ago

7.0.0-next.68

10 months ago

7.0.0-next.66

10 months ago

7.0.0-next.65

10 months ago

7.0.0-next.64

10 months ago

7.0.0-next.63

10 months ago

7.0.0-next.62

10 months ago

7.0.0-next.61

10 months ago

6.47.1

1 year ago

7.0.0-next.44

11 months ago

7.0.0-next.45

11 months ago

7.0.0-next.46

11 months ago

7.0.0-next.47

11 months ago

7.0.0-next.48

11 months ago

7.0.0-next.49

11 months ago

7.0.0-next.40

1 year ago

7.0.0-next.41

12 months ago

7.0.0-next.42

12 months ago

7.0.0-next.54

11 months ago

7.0.0-next.55

11 months ago

7.0.0-next.56

11 months ago

7.0.0-next.57

11 months ago

7.0.0-next.58

11 months ago

7.0.0-next.59

10 months ago

7.0.0-next.50

11 months ago

7.0.0-next.51

11 months ago

7.2.0-canary.20

1 year ago

7.0.0-next.52

11 months ago

7.0.0-next.53

11 months ago

7.0.0-next.29

1 year ago

7.2.0-canary.0

1 year ago

7.2.0-canary.1

1 year ago

7.0.0-next.28

1 year ago

7.0.0-next.32

1 year ago

7.0.0-next.33

1 year ago

7.0.0-next.34

1 year ago

7.0.0-next.37

1 year ago

7.0.0-next.38

1 year ago

7.0.0-next.39

1 year ago

7.0.1-canary.12

1 year ago

7.0.1-canary.11

1 year ago

7.0.0-next.30

1 year ago

7.0.1-canary.10

1 year ago

7.0.0-next.31

1 year ago

7.3.0-canary.2

1 year ago

7.3.0-canary.1

1 year ago

7.3.0-canary.0

1 year ago

7.3.0-canary.4

1 year ago

7.3.0-canary.3

1 year ago

7.0.0-next.60

10 months ago

7.0.1-canary.0

1 year ago

7.0.0-next.26

1 year ago

7.0.0-next.27

1 year ago

7.0.0-next.25

1 year ago

7.0.0-next.22

1 year ago

7.0.0-next.23

1 year ago

7.0.0-next.21

1 year ago

7.0.0-next.9

1 year ago

7.0.0-next.10

1 year ago

7.0.0-next.7

1 year ago

7.0.0-next.11

1 year ago

7.0.0-next.8

1 year ago

7.0.0-next.12

1 year ago

7.0.0-next.13

1 year ago

7.0.0-next.6

1 year ago

7.0.0-next.20

1 year ago

7.0.0-next.5

1 year ago

6.46.8

1 year ago

7.0.0-next.4

1 year ago

7.0.0-next.3

1 year ago

7.0.0-next.2

1 year ago

7.0.0-next.1

1 year ago

7.0.0-next.0

1 year ago

6.46.7

1 year ago

7.0.0-cli.7

1 year ago

7.0.0-cli.6

1 year ago

6.46.1-cli.0

1 year ago

7.0.0-cli.5

1 year ago

7.0.0-cli.4

1 year ago

7.0.0-cli.1

1 year ago

7.0.0-cli.0

1 year ago

7.0.0-cli.3

1 year ago

7.0.0-cli.2

1 year ago

6.46.3-cli.0

1 year ago

6.46.2

1 year ago

7.0.0-canary.1

1 year ago

6.46.2-esm.0

1 year ago

6.45.2

1 year ago

6.45.0

1 year ago

6.43.0

2 years ago

6.39.3

2 years ago

6.39.0

2 years ago

6.38.8

2 years ago

6.38.5

2 years ago

6.38.1

2 years ago

6.36.1

2 years ago

6.38.0

2 years ago

6.34.6

3 years ago

6.36.0

2 years ago

6.34.3

3 years ago

6.34.4

3 years ago

6.34.2

3 years ago

6.26.1

3 years ago

6.31.0

3 years ago

6.28.0

3 years ago

6.21.0

3 years ago

6.24.2

3 years ago

6.24.0

3 years ago

6.20.4

3 years ago

6.20.3

3 years ago

6.20.2

3 years ago

6.19.0

3 years ago

6.10.1

3 years ago

6.10.0

3 years ago

6.14.0

3 years ago

6.11.2

3 years ago

6.17.0

3 years ago

6.15.2

3 years ago

6.7.0

4 years ago

6.0.12

4 years ago

6.0.0

4 years ago

6.0.0-canary.13

4 years ago

6.0.0-canary.9

4 years ago

5.10.0

5 years ago

6.0.0-canary.2

5 years ago

5.9.0

5 years ago

5.8.0

5 years ago