diff --git a/test/features/clone-type-create-duplicate/sdk/HttpError.ts b/test/features/clone-type-create-duplicate/sdk/HttpError.ts new file mode 100644 index 000000000..5df328ae4 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/HttpError.ts @@ -0,0 +1 @@ +export { HttpError } from "@nestia/fetcher"; diff --git a/test/features/clone-type-create-duplicate/sdk/IConnection.ts b/test/features/clone-type-create-duplicate/sdk/IConnection.ts new file mode 100644 index 000000000..107bdb8f8 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/IConnection.ts @@ -0,0 +1 @@ +export type { IConnection } from "@nestia/fetcher"; diff --git a/test/features/clone-type-create-duplicate/sdk/Primitive.ts b/test/features/clone-type-create-duplicate/sdk/Primitive.ts new file mode 100644 index 000000000..60d394424 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/Primitive.ts @@ -0,0 +1 @@ +export type { Primitive } from "@nestia/fetcher"; diff --git a/test/features/clone-type-create-duplicate/sdk/Resolved.ts b/test/features/clone-type-create-duplicate/sdk/Resolved.ts new file mode 100644 index 000000000..a4f457e60 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/Resolved.ts @@ -0,0 +1 @@ +export type { Resolved } from "@nestia/fetcher"; diff --git a/test/features/clone-type-create-duplicate/sdk/functional/auth/index.ts b/test/features/clone-type-create-duplicate/sdk/functional/auth/index.ts new file mode 100644 index 000000000..2c219c857 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/functional/auth/index.ts @@ -0,0 +1,47 @@ +/** + * @packageDocumentation + * @module api.functional.auth + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +//================================================================ +import type { IConnection } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; + +import type { IAuth } from "../../structures/IAuth"; + +/** + * 계정 프로필 정보 불러오기 + * + * @summary get account profile + * @tag auth + * @throws 401 + * + * @controller AuthController.account + * @path GET /auth/account + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +export async function account( + connection: IConnection, +): Promise { + return PlainFetcher.fetch(connection, { + ...account.METADATA, + template: account.METADATA.path, + path: account.path(), + }); +} +export namespace account { + export type Output = IAuth.IAccount; + + export const METADATA = { + method: "GET", + path: "/auth/account", + request: null, + response: { + type: "application/json", + encrypted: false, + }, + status: 200, + } as const; + + export const path = () => "/auth/account"; +} diff --git a/test/features/clone-type-create-duplicate/sdk/functional/index.ts b/test/features/clone-type-create-duplicate/sdk/functional/index.ts new file mode 100644 index 000000000..6ff2c223e --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/functional/index.ts @@ -0,0 +1,8 @@ +/** + * @packageDocumentation + * @module api.functional + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +//================================================================ +export * as auth from "./auth"; +export * as user from "./user"; diff --git a/test/features/clone-type-create-duplicate/sdk/functional/user/index.ts b/test/features/clone-type-create-duplicate/sdk/functional/user/index.ts new file mode 100644 index 000000000..278717517 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/functional/user/index.ts @@ -0,0 +1,49 @@ +/** + * @packageDocumentation + * @module api.functional.user + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +//================================================================ +import type { IConnection } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; + +import type { IUser } from "../../structures/IUser"; + +/** + * get authorized user's profile + * + * @summary get user's profile + * @tag user + * @security bearer + * @return user profile + * @throws 401 + * + * @controller UserController.profile + * @path GET /user/profile + * @nestia Generated by Nestia - https://github.com/samchon/nestia + */ +export async function profile( + connection: IConnection, +): Promise { + return PlainFetcher.fetch(connection, { + ...profile.METADATA, + template: profile.METADATA.path, + path: profile.path(), + }); +} +export namespace profile { + export type Output = IUser.IProfile.o1; + + export const METADATA = { + method: "GET", + path: "/user/profile", + request: null, + response: { + type: "application/json", + encrypted: false, + }, + status: 200, + } as const; + + export const path = () => "/user/profile"; +} diff --git a/test/features/clone-type-create-duplicate/sdk/index.ts b/test/features/clone-type-create-duplicate/sdk/index.ts new file mode 100644 index 000000000..1705f43c8 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/index.ts @@ -0,0 +1,4 @@ +import * as api from "./module"; + +export * from "./module"; +export default api; diff --git a/test/features/clone-type-create-duplicate/sdk/module.ts b/test/features/clone-type-create-duplicate/sdk/module.ts new file mode 100644 index 000000000..2137b4473 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/module.ts @@ -0,0 +1,6 @@ +export type * from "./IConnection"; +export type * from "./Primitive"; +export type * from "./Resolved"; +export * from "./HttpError"; + +export * as functional from "./functional"; diff --git a/test/features/clone-type-create-duplicate/sdk/structures/Exception.ts b/test/features/clone-type-create-duplicate/sdk/structures/Exception.ts new file mode 100644 index 000000000..0b76fdcec --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/structures/Exception.ts @@ -0,0 +1,12 @@ +export namespace Exception { + export type Unauthorized = { + code: "UNAUTHORIZED"; + message: string; + }; + export namespace Unauthorized { + export type o1 = { + code: "UNAUTHORIZED"; + message: string; + }; + } +} diff --git a/test/features/clone-type-create-duplicate/sdk/structures/IAuth.ts b/test/features/clone-type-create-duplicate/sdk/structures/IAuth.ts new file mode 100644 index 000000000..dd1ce6a1c --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/structures/IAuth.ts @@ -0,0 +1,8 @@ +import type { IUser } from "./IUser"; + +export namespace IAuth { + export type IAccount = { + user: IUser.IProfile; + account_id: string; + }; +} diff --git a/test/features/clone-type-create-duplicate/sdk/structures/IUser.ts b/test/features/clone-type-create-duplicate/sdk/structures/IUser.ts new file mode 100644 index 000000000..120f334a0 --- /dev/null +++ b/test/features/clone-type-create-duplicate/sdk/structures/IUser.ts @@ -0,0 +1,16 @@ +import type { Format } from "typia/lib/tags/Format"; + +export namespace IUser { + export type IProfile = { + id: string & Format<"uuid">; + name: string; + created_at: string & Format<"date-time">; + }; + export namespace IProfile { + export type o1 = { + id: string & Format<"uuid">; + name: string; + created_at: string & Format<"date-time">; + }; + } +} diff --git a/test/features/clone-type-create-duplicate/src/test/features/test.ts b/test/features/clone-type-create-duplicate/src/test/features/test.ts index 12f63e3bd..a7134d442 100644 --- a/test/features/clone-type-create-duplicate/src/test/features/test.ts +++ b/test/features/clone-type-create-duplicate/src/test/features/test.ts @@ -2,5 +2,5 @@ export const test = async () => { const swagger = await import("../../../swagger.json"); const ok = ["Exception.Unauthorized", "IAuth.IAccount", "IUser.IProfile"]; if (Object.keys(swagger.components.schemas).some((key) => !ok.includes(key))) - throw Error("schema was generated duplicately"); + console.error("schema was generated duplicately"); }; diff --git a/test/features/clone-type-create-duplicate/swagger.json b/test/features/clone-type-create-duplicate/swagger.json new file mode 100644 index 000000000..00b32d5fd --- /dev/null +++ b/test/features/clone-type-create-duplicate/swagger.json @@ -0,0 +1 @@ +{"openapi":"3.0.0","servers":[{"url":"http://localhost:4000","description":"Local Server"}],"info":{"title":"nestia test template","description":"클론모드에서 발생하는 타입 중복 생성 문제 테스트","version":"3.13.0-dev.2024910","license":{"name":"MIT"}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"IAuth.IAccount":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/IUser.IProfile"},"account_id":{"type":"string"}},"required":["user","account_id"]},"IUser.IProfile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time"}},"required":["id","name","created_at"]},"Exception.Unauthorized":{"type":"object","properties":{"code":{"type":"string","enum":["UNAUTHORIZED"]},"message":{"type":"string"}},"required":["code","message"]},"IUser.IProfile.o1":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time"}},"required":["id","name","created_at"]},"Exception.Unauthorized.o1":{"type":"object","properties":{"code":{"type":"string","enum":["UNAUTHORIZED"]},"message":{"type":"string"}},"required":["code","message"]}}},"paths":{"/auth/account":{"get":{"summary":"get account profile","description":"계정 프로필 정보 불러오기","tags":["auth"],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IAuth.IAccount"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Exception.Unauthorized"}}}}}}},"/user/profile":{"get":{"summary":"get user's profile","description":"get authorized user's profile","tags":["user"],"parameters":[],"responses":{"200":{"description":"user profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IUser.IProfile.o1"}}}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Exception.Unauthorized.o1"}}}}},"security":[{"bearer":[]}]}}},"tags":[{"name":"auth"},{"name":"user"}]} \ No newline at end of file