1.0.5 • Published 7 days ago

@elysiajs/swagger v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 days ago

@elysiajs/swagger

Plugin for elysia to auto-generate Swagger page.

Installation

bun add @elysiajs/swagger

Example

import { Elysia, t } from 'elysia'
import { swagger } from '@elysiajs/swagger'

const app = new Elysia()
    .use(swagger())
    .get('/', () => 'hi', { response: t.String({ description: 'sample description' }) })
    .post(
        '/json/:id',
        ({ body, params: { id }, query: { name } }) => ({
            ...body,
            id,
            name
        }),
        {
            params: t.Object({
                id: t.String()
            }),
            query: t.Object({
                name: t.String()
            }),
            body: t.Object({
                username: t.String(),
                password: t.String()
            }),
            response: t.Object({
                username: t.String(),
                password: t.String(),
                id: t.String(),
                name: t.String()
            }, { description: 'sample description' })
        }
    )
    .listen(8080);

Then go to http://localhost:8080/swagger.

config

provider

@default 'scalar' Choose between Scalar & SwaggerUI

scalar

Customize scalarConfig, refers to Scalar config

swagger

Customize Swagger config, refers to Swagger 3.0.3 config

path

@default '/swagger'

The endpoint to expose Swagger

excludeStaticFile

@default true

Determine if Swagger should exclude static files.

exclude

@default []

Paths to exclude from the Swagger endpoint

1.0.5

7 days ago

1.0.4

17 days ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.0

2 months ago

1.0.0-rc.0

2 months ago

1.0.0-beta.2

2 months ago

1.0.0-beta.1

3 months ago

1.0.0-beta.0

3 months ago

0.8.5

4 months ago

0.8.4

4 months ago

0.8.1

4 months ago

0.8.3

4 months ago

0.8.2

4 months ago

0.8.0

5 months ago

0.8.0-rc.0

5 months ago

0.7.0-beta.0

8 months ago

0.6.0-rc.0

9 months ago

0.7.2

8 months ago

0.6.0-beta.0

9 months ago

0.7.1

8 months ago

0.6.2

8 months ago

0.7.4

6 months ago

0.7.3

8 months ago

0.7.0

8 months ago

0.6.1

9 months ago

0.6.0

9 months ago

0.5.0-beta.0

12 months ago

0.5.0-rc.1

12 months ago

0.3.0

1 year ago

0.3.0-beta.0

1 year ago

0.3.0-rc.0

1 year ago

0.5.0

12 months ago

0.4.0

1 year ago

0.5.2

11 months ago

0.5.0-rc.0

12 months ago

0.5.1

11 months ago

0.2.0

1 year ago

0.2.0-rc.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.1.0-rc.6

1 year ago

0.1.0-rc.5

1 year ago

0.1.0-rc.4

1 year ago

0.1.0-rc.3

1 year ago

0.1.0-rc.2

1 year ago

0.1.0-rc.1

1 year ago