import swagger, { type ElysiaSwaggerConfig } from " @elysiajs/swagger "
import pgk from " @root/package.json "
export type SwaggerTags = {
export const defaultSwaggerTags : SwaggerTags [] = [
{ name: " health " , description: " Get the health of the API. Verifying if it is up and running " },
* Converts a string from kebab case to title case.
* This function takes a string in kebab case (e.g., "hello-world") and converts it to title case (e.g., "Hello World").
* @param kebabCaseString - The string in kebab case to be converted.
* @returns The converted string in title case.
* convertKebabCaseToTitle("hello-world") // Returns: "Hello World"
function convertKebabCaseToTitleCase ( kebabCaseString : string ) : string {
return kebabCaseString . replace ( / - / g , " " ) . replace ( / \b \w / g , ( char ) => char . toUpperCase ())
* This method is used to generate Swagger documentation from the provided tags.
* It merges the default tags with the provided tags and creates a Swagger object.
* @param fromTags - The custom tags to be added to the Swagger documentation.
* @param config - The configuration object for the Swagger documentation.
* @returns The Swagger documentation object.
fromTags : ( fromTags : SwaggerTags [] , config : ElysiaSwaggerConfig = {} ) => {
authorizationUrl: " https://auth.flowcore.io/realms/flowcore/protocol/openid-connect/auth " ,
tokenUrl: " https://auth.flowcore.io/realms/flowcore/protocol/openid-connect/token " ,
redirectUri: " http://localhost:3000/auth/callback " ,
openid: " OpenID Connect " ,
flowcore_user: " Flowcore User " ,
selectedScopes: [ " openid " , " profile " , " email " , " flowcore_user " ] ,
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
tags: [ ... defaultSwaggerTags, ... fromTags] ,
title: convertKebabCaseToTitleCase (pgk . name ) ,
description: pgk . description ,
export { swaggerFactory }