Skip to content

Commit

Permalink
Merge pull request #120 from kaanduraa/feature/excluded-tags
Browse files Browse the repository at this point in the history
feature: exclude tags
  • Loading branch information
marclave committed Apr 29, 2024
2 parents dd45a69 + 1d63b85 commit ff6e88e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.ts
Expand Up @@ -30,7 +30,8 @@ export const swagger =
swaggerOptions = {},
theme = `https://unpkg.com/swagger-ui-dist@${version}/swagger-ui.css`,
autoDarkMode = true,
excludeMethods = ['OPTIONS']
excludeMethods = ['OPTIONS'],
excludeTags = []
}: ElysiaSwaggerConfig<Path> = {
provider: 'scalar',
scalarVersion: 'latest',
Expand All @@ -43,7 +44,8 @@ export const swagger =
exclude: [],
swaggerOptions: {},
autoDarkMode: true,
excludeMethods: ['OPTIONS']
excludeMethods: ['OPTIONS'],
excludeTags: []
}
) =>
(app: Elysia) => {
Expand Down Expand Up @@ -136,6 +138,7 @@ export const swagger =
openapi: '3.0.3',
...{
...documentation,
tags: documentation.tags?.filter((tag) => !excludeTags?.includes(tag?.name)),
info: {
title: 'Elysia Documentation',
description: 'Development documentation',
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Expand Up @@ -111,4 +111,9 @@ export interface ElysiaSwaggerConfig<Path extends string = '/swagger'> {
* Exclude methods from Swagger
*/
excludeMethods?: string[]

/**
* Exclude tags from Swagger or Scalar
*/
excludeTags?: string[]
}

0 comments on commit ff6e88e

Please sign in to comment.