Merge pull request #120 from kaanduraa/feature/excluded-tags

feature: exclude tags
This commit is contained in:
Marc Laventure
2024-04-29 14:42:51 -07:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -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',
@@ -43,7 +44,8 @@ export const swagger =
exclude: [],
swaggerOptions: {},
autoDarkMode: true,
excludeMethods: ['OPTIONS']
excludeMethods: ['OPTIONS'],
excludeTags: []
}
) =>
(app: Elysia) => {
@@ -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',

View File

@@ -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[]
}