diff --git a/src/converters/HttpLlmConverter.ts b/src/converters/HttpLlmConverter.ts index 9f2bc42..0c239c8 100644 --- a/src/converters/HttpLlmConverter.ts +++ b/src/converters/HttpLlmConverter.ts @@ -168,6 +168,7 @@ const composeFunction = return operation.description ?? operation.summary; })(), deprecated: operation.deprecated, + tags: operation.tags, route: () => route, operation: () => operation, }; diff --git a/src/structures/IHttpLlmFunction.ts b/src/structures/IHttpLlmFunction.ts index 6250b44..d7592b8 100644 --- a/src/structures/IHttpLlmFunction.ts +++ b/src/structures/IHttpLlmFunction.ts @@ -195,6 +195,13 @@ export interface IHttpLlmFunction< */ deprecated?: boolean | undefined; + /** + * Category tags for the function. + * + * Same with {@link OpenApi.IOperation.tags} indicating the category of the function. + */ + tags?: string[]; + /** * Get the Swagger operation metadata. * diff --git a/src/structures/ILlmFunction.ts b/src/structures/ILlmFunction.ts index 8cbf497..c275207 100644 --- a/src/structures/ILlmFunction.ts +++ b/src/structures/ILlmFunction.ts @@ -67,6 +67,13 @@ export interface ILlmFunction { * LLM (Large Language Model) may not use the deprecated function. */ deprecated?: boolean | undefined; + + /** + * Category tags for the function. + * + * You can fill this property by the `@tag ${name}` comment tag. + */ + tags?: string[]; } export namespace ILlmFunction { /** diff --git a/test/controllers/AppController.ts b/test/controllers/AppController.ts index 3cab31d..74a402a 100644 --- a/test/controllers/AppController.ts +++ b/test/controllers/AppController.ts @@ -31,6 +31,10 @@ export class AppController { return { index, level, optimal, query }; } + /** + * @tag body + * @tag post + */ @TypedRoute.Post(":index/:level/:optimal/body") public body( @TypedParam("index") diff --git a/test/features/llm/test_http_llm_function_tags.ts b/test/features/llm/test_http_llm_function_tags.ts new file mode 100644 index 0000000..88c172f --- /dev/null +++ b/test/features/llm/test_http_llm_function_tags.ts @@ -0,0 +1,20 @@ +import { TestValidator } from "@nestia/e2e"; +import { + HttpLlm, + IHttpLlmApplication, + IHttpLlmFunction, + OpenApi, +} from "@samchon/openapi"; + +import swagger from "../../swagger.json"; + +export const test_http_llm_function_deprecated = (): void => { + const document: OpenApi.IDocument = OpenApi.convert(swagger as any); + const application: IHttpLlmApplication = HttpLlm.application(document, { + keyword: true, + }); + const func: IHttpLlmFunction | undefined = application.functions.find( + (f) => f.method === "post" && f.path === "/{index}/{level}/{optimal}/body", + ); + TestValidator.equals("tags")(func?.tags)(["body", "post"]); +}; diff --git a/test/swagger.json b/test/swagger.json index 9d3b4b4..34070e2 100644 --- a/test/swagger.json +++ b/test/swagger.json @@ -7,7 +7,7 @@ } ], "info": { - "version": "1.0.4", + "version": "1.0.5", "title": "@samchon/openapi", "description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", "license": { @@ -127,7 +127,10 @@ }, "/{index}/{level}/{optimal}/body": { "post": { - "tags": [], + "tags": [ + "body", + "post" + ], "parameters": [ { "name": "index", @@ -437,6 +440,13 @@ } } }, - "tags": [], + "tags": [ + { + "name": "body" + }, + { + "name": "post" + } + ], "x-samchon-emended": true } \ No newline at end of file