MCPcopy Index your code
hub / github.com/elysiajs/elysia-openapi

github.com/elysiajs/elysia-openapi @1.4.15

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.4.15 ↗ · + Follow
49 symbols 154 edges 24 files 1 documented · 2% updated 7d ago1.4.15 · 2026-04-23★ 178124 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

@elysia/openapi

Elysia plugin to add OpenAPI documentation.

Installation

bun add @elysia/openapi

Example

import { Elysia, t } from 'elysia'
import { openapi } from '@elysia/openapi'

const app = new Elysia()
    .use(openapi())
    .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(3000)

Then go to http://localhost:3000/openapi.

config

enabled

@default true Enable/Disable the plugin

documentation

OpenAPI documentation information

@see https://spec.openapis.org/oas/v3.0.3.html

exclude

Configuration to exclude paths or methods from documentation

exclude.methods

List of methods to exclude from documentation

exclude.paths

List of paths to exclude from documentation

exclude.staticFile

@default true

Exclude static file routes from documentation

exclude.tags

List of tags to exclude from documentation

path

@default '/openapi'

The endpoint to expose OpenAPI documentation frontend

provider

@default 'scalar'

OpenAPI documentation frontend between:

references

Additional OpenAPI reference for each endpoint

scalar

Scalar configuration, refers to Scalar config

specPath

@default '/${path}/json'

The endpoint to expose OpenAPI specification in JSON format

swagger

Swagger config, refers to Swagger config

See documentation for more details.

Extension points exported contracts — how you extend this code

SwaggerUIPlugin (Interface)
* See https://swagger.io/docs/open-source-tools/swagger-ui/customization/plugin-api/
src/swagger/types.ts
ElysiaOpenAPIConfig (Interface)
(no doc)
src/types.ts
OpenAPIGeneratorOptions (Interface)
(no doc)
src/gen/index.ts
SwaggerUIOptions (Interface)
(no doc)
src/swagger/types.ts
PluginsOptions (Interface)
(no doc)
src/swagger/types.ts
Request (Interface)
(no doc)
src/swagger/types.ts
Response (Interface)
(no doc)
src/swagger/types.ts

Core symbols most depended-on inside this repo

openapi
called by 19
src/index.ts
join
called by 13
src/gen/index.ts
unwrapSchema
called by 12
src/openapi.ts
enumToOpenApi
called by 12
src/openapi.ts
normalizeSchemaReference
called by 11
src/openapi.ts
unwrapReference
called by 7
src/openapi.ts
toOpenAPISchema
called by 7
src/openapi.ts
declarationToJSONSchema
called by 7
src/gen/index.ts

Shape

Function 41
Interface 8

Languages

TypeScript100%

Modules by API surface

src/openapi.ts19 symbols
src/swagger/types.ts6 symbols
src/index.ts5 symbols
src/gen/index.ts5 symbols
src/swagger/index.ts4 symbols
test/openapi/to-openapi-schema.test.ts2 symbols
test/validate-schema.test.ts1 symbols
test/openapi/references.test.ts1 symbols
test/index.test.ts1 symbols
test/guard-schema.test.ts1 symbols
test/gen/index.test.ts1 symbols
src/types.ts1 symbols

For agents

$ claude mcp add elysia-openapi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page