Skip to content

Commit ff6e88e

Browse files
authored
Merge pull request #120 from kaanduraa/feature/excluded-tags
feature: exclude tags
2 parents dd45a69 + 1d63b85 commit ff6e88e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const swagger =
3030
swaggerOptions = {},
3131
theme = `https://unpkg.com/swagger-ui-dist@${version}/swagger-ui.css`,
3232
autoDarkMode = true,
33-
excludeMethods = ['OPTIONS']
33+
excludeMethods = ['OPTIONS'],
34+
excludeTags = []
3435
}: ElysiaSwaggerConfig<Path> = {
3536
provider: 'scalar',
3637
scalarVersion: 'latest',
@@ -43,7 +44,8 @@ export const swagger =
4344
exclude: [],
4445
swaggerOptions: {},
4546
autoDarkMode: true,
46-
excludeMethods: ['OPTIONS']
47+
excludeMethods: ['OPTIONS'],
48+
excludeTags: []
4749
}
4850
) =>
4951
(app: Elysia) => {
@@ -136,6 +138,7 @@ export const swagger =
136138
openapi: '3.0.3',
137139
...{
138140
...documentation,
141+
tags: documentation.tags?.filter((tag) => !excludeTags?.includes(tag?.name)),
139142
info: {
140143
title: 'Elysia Documentation',
141144
description: 'Development documentation',

src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,9 @@ export interface ElysiaSwaggerConfig<Path extends string = '/swagger'> {
111111
* Exclude methods from Swagger
112112
*/
113113
excludeMethods?: string[]
114+
115+
/**
116+
* Exclude tags from Swagger or Scalar
117+
*/
118+
excludeTags?: string[]
114119
}

0 commit comments

Comments
 (0)