From b04480764faa7d5c735f8ad6cad3b98d60f681d7 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Sun, 17 Nov 2024 01:47:09 +0900 Subject: [PATCH 1/2] Adapt typia v7 and nestia v4 for testing. --- package.json | 8 ++++---- .../chatgpt/test_chatgpt_schema_oneof_discriminator.ts | 6 +++--- test/features/llm/chatgpt/test_chatgpt_schema_ref.ts | 8 ++++---- test/features/llm/test_llm_schema_object.ts | 4 ++-- test/features/llm/test_llm_schema_oneof.ts | 6 +++--- test/features/llm/test_llm_schema_separate_array.ts | 10 +++------- test/features/llm/test_llm_schema_separate_nested.ts | 8 +++----- test/features/llm/test_llm_schema_separate_object.ts | 6 +++--- .../llm/v3.1/test_llm_schema_v31_ultimate_union.ts | 2 +- .../test_json_schema_type_checker_cover_array.ts | 6 +++--- .../test_json_schema_type_checker_cover_object.ts | 6 +++--- .../test_json_schema_type_checker_cover_string.ts | 4 ++-- 12 files changed, 34 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index 9bd666f..d3e0f9c 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,10 @@ }, "homepage": "https://github.com/samchon/openapi", "devDependencies": { - "@nestia/core": "^3.12.0", + "@nestia/core": "^4.0.0-dev.20241116", "@nestia/e2e": "^0.7.0", - "@nestia/fetcher": "^3.12.0", - "@nestia/sdk": "^3.12.0", + "@nestia/fetcher": "^4.0.0-dev.20241116", + "@nestia/sdk": "^4.0.0-dev.20241116", "@nestjs/common": "^10.4.1", "@nestjs/core": "^10.4.1", "@nestjs/platform-express": "^10.4.1", @@ -56,7 +56,7 @@ "ts-patch": "^3.2.1", "typescript": "^5.6.3", "typescript-transform-paths": "^3.4.7", - "typia": "^6.9.0", + "typia": "^7.0.0-dev.20241115", "uuid": "^10.0.0" }, "sideEffects": false, diff --git a/test/features/llm/chatgpt/test_chatgpt_schema_oneof_discriminator.ts b/test/features/llm/chatgpt/test_chatgpt_schema_oneof_discriminator.ts index 39d82fa..2d2059d 100644 --- a/test/features/llm/chatgpt/test_chatgpt_schema_oneof_discriminator.ts +++ b/test/features/llm/chatgpt/test_chatgpt_schema_oneof_discriminator.ts @@ -1,11 +1,11 @@ import { TestValidator } from "@nestia/e2e"; import { IChatGptSchema } from "@samchon/openapi"; import { ChatGptConverter } from "@samchon/openapi/lib/converters/ChatGptConverter"; -import typia, { IJsonApplication } from "typia"; +import typia, { IJsonSchemaCollection } from "typia"; export const test_chatgpt_schema_oneof_discriminator = (): void => { - const collection: IJsonApplication = - typia.json.application<[IPoint | ILine | ITriangle | IRectangle]>(); + const collection: IJsonSchemaCollection = + typia.json.schemas<[IPoint | ILine | ITriangle | IRectangle]>(); const schema = ChatGptConverter.schema({ components: collection.components, schema: collection.schemas[0], diff --git a/test/features/llm/chatgpt/test_chatgpt_schema_ref.ts b/test/features/llm/chatgpt/test_chatgpt_schema_ref.ts index 6e103da..9dfc9a4 100644 --- a/test/features/llm/chatgpt/test_chatgpt_schema_ref.ts +++ b/test/features/llm/chatgpt/test_chatgpt_schema_ref.ts @@ -1,10 +1,10 @@ import { TestValidator } from "@nestia/e2e"; import { IChatGptSchema } from "@samchon/openapi"; import { ChatGptConverter } from "@samchon/openapi/lib/converters/ChatGptConverter"; -import typia, { IJsonApplication, tags } from "typia"; +import typia, { IJsonSchemaCollection, tags } from "typia"; export const test_chatgpt_schema_ref = (): void => { - test(typia.json.application<[IShoppingCategory]>(), { + test(typia.json.schemas<[IShoppingCategory]>(), { $ref: "#/$defs/IShoppingCategory", $defs: { IShoppingCategory: { @@ -29,7 +29,7 @@ export const test_chatgpt_schema_ref = (): void => { }, }, }); - test(typia.json.application<[IShoppingCategory.IInvert]>(), { + test(typia.json.schemas<[IShoppingCategory.IInvert]>(), { $ref: "#/$defs/IShoppingCategory.IInvert", $defs: { "IShoppingCategory.IInvert": { @@ -61,7 +61,7 @@ export const test_chatgpt_schema_ref = (): void => { }; const test = ( - collection: IJsonApplication, + collection: IJsonSchemaCollection, expected: IChatGptSchema.ITop, ): void => { const schema: IChatGptSchema.ITop | null = ChatGptConverter.schema({ diff --git a/test/features/llm/test_llm_schema_object.ts b/test/features/llm/test_llm_schema_object.ts index 206579d..f81ccb8 100644 --- a/test/features/llm/test_llm_schema_object.ts +++ b/test/features/llm/test_llm_schema_object.ts @@ -1,9 +1,9 @@ import { TestValidator } from "@nestia/e2e"; import { HttpLlm, ILlmSchemaV3 } from "@samchon/openapi"; -import typia, { IJsonApplication, tags } from "typia"; +import typia, { IJsonSchemaCollection, tags } from "typia"; export const test_llm_schema_object = (): void => { - const app: IJsonApplication = typia.json.application<[First]>(); + const app: IJsonSchemaCollection = typia.json.schemas<[First]>(); const schema: ILlmSchemaV3 | null = HttpLlm.schema({ model: "3.0", components: app.components, diff --git a/test/features/llm/test_llm_schema_oneof.ts b/test/features/llm/test_llm_schema_oneof.ts index d5a3246..d262f0f 100644 --- a/test/features/llm/test_llm_schema_oneof.ts +++ b/test/features/llm/test_llm_schema_oneof.ts @@ -1,10 +1,10 @@ import { TestValidator } from "@nestia/e2e"; import { HttpLlm, ILlmSchemaV3 } from "@samchon/openapi"; -import typia, { IJsonApplication } from "typia"; +import typia, { IJsonSchemaCollection } from "typia"; export const test_llm_schema_oneof = (): void => { - const app: IJsonApplication = - typia.json.application<[Circle | Triangle | Rectangle]>(); + const app: IJsonSchemaCollection = + typia.json.schemas<[Circle | Triangle | Rectangle]>(); const casted: ILlmSchemaV3 | null = HttpLlm.schema({ model: "3.0", components: app.components, diff --git a/test/features/llm/test_llm_schema_separate_array.ts b/test/features/llm/test_llm_schema_separate_array.ts index 6728f09..a3e6857 100644 --- a/test/features/llm/test_llm_schema_separate_array.ts +++ b/test/features/llm/test_llm_schema_separate_array.ts @@ -15,13 +15,9 @@ export const test_llm_schema_separate_array = (): void => { LlmTypeCheckerV3.isString(s) && s.contentMediaType !== undefined, schema, }); - const member: ILlmSchemaV3 = schema(typia.json.application<[IMember[]]>()); - const upload: ILlmSchemaV3 = schema( - typia.json.application<[IFileUpload[]]>(), - ); - const combined: ILlmSchemaV3 = schema( - typia.json.application<[ICombined[]]>(), - ); + const member: ILlmSchemaV3 = schema(typia.json.schemas<[IMember[]]>()); + const upload: ILlmSchemaV3 = schema(typia.json.schemas<[IFileUpload[]]>()); + const combined: ILlmSchemaV3 = schema(typia.json.schemas<[ICombined[]]>()); TestValidator.equals("member")(separator(member))([member, null]); TestValidator.equals("upload")(separator(upload))([null, upload]); diff --git a/test/features/llm/test_llm_schema_separate_nested.ts b/test/features/llm/test_llm_schema_separate_nested.ts index cb2f94c..e0db835 100644 --- a/test/features/llm/test_llm_schema_separate_nested.ts +++ b/test/features/llm/test_llm_schema_separate_nested.ts @@ -15,14 +15,12 @@ export const test_llm_schema_separate_nested = (): void => { LlmTypeCheckerV3.isString(s) && s.contentMediaType !== undefined, schema, }); - const member: ILlmSchemaV3 = schema( - typia.json.application<[INested]>(), - ); + const member: ILlmSchemaV3 = schema(typia.json.schemas<[INested]>()); const upload: ILlmSchemaV3 = schema( - typia.json.application<[INested]>(), + typia.json.schemas<[INested]>(), ); const combined: ILlmSchemaV3 = schema( - typia.json.application<[INested]>(), + typia.json.schemas<[INested]>(), ); TestValidator.equals( diff --git a/test/features/llm/test_llm_schema_separate_object.ts b/test/features/llm/test_llm_schema_separate_object.ts index 315a85e..0d465a3 100644 --- a/test/features/llm/test_llm_schema_separate_object.ts +++ b/test/features/llm/test_llm_schema_separate_object.ts @@ -15,9 +15,9 @@ export const test_llm_schema_separate_object = (): void => { LlmTypeCheckerV3.isString(s) && s.contentMediaType !== undefined, schema, }); - const member: ILlmSchemaV3 = schema(typia.json.application<[IMember]>()); - const upload: ILlmSchemaV3 = schema(typia.json.application<[IFileUpload]>()); - const combined: ILlmSchemaV3 = schema(typia.json.application<[ICombined]>()); + const member: ILlmSchemaV3 = schema(typia.json.schemas<[IMember]>()); + const upload: ILlmSchemaV3 = schema(typia.json.schemas<[IFileUpload]>()); + const combined: ILlmSchemaV3 = schema(typia.json.schemas<[ICombined]>()); TestValidator.equals( "member", diff --git a/test/features/llm/v3.1/test_llm_schema_v31_ultimate_union.ts b/test/features/llm/v3.1/test_llm_schema_v31_ultimate_union.ts index a89857a..d2f4442 100644 --- a/test/features/llm/v3.1/test_llm_schema_v31_ultimate_union.ts +++ b/test/features/llm/v3.1/test_llm_schema_v31_ultimate_union.ts @@ -3,7 +3,7 @@ import { HttpLlmConverter } from "@samchon/openapi/lib/converters/HttpLlmConvert import typia from "typia"; export const test_llm_schema_v31_ultimate_union = (): void => { - const collection = typia.json.application<[IJsonSchemaCollection[]]>(); + const collection = typia.json.schemas<[IJsonSchemaCollection[]]>(); HttpLlmConverter.schema({ model: "3.1", components: collection.components, diff --git a/test/features/openapi/test_json_schema_type_checker_cover_array.ts b/test/features/openapi/test_json_schema_type_checker_cover_array.ts index 5ba4128..163d1b4 100644 --- a/test/features/openapi/test_json_schema_type_checker_cover_array.ts +++ b/test/features/openapi/test_json_schema_type_checker_cover_array.ts @@ -1,10 +1,10 @@ import { TestValidator } from "@nestia/e2e"; import { OpenApi, OpenApiTypeChecker } from "@samchon/openapi"; -import typia, { IJsonApplication } from "typia"; +import typia, { IJsonSchemaCollection } from "typia"; export const test_json_schema_type_checker_cover_array = (): void => { - const app: IJsonApplication = - typia.json.application<[Plan2D, Plan3D, Box2D, Box3D]>(); + const app: IJsonSchemaCollection = + typia.json.schemas<[Plan2D, Plan3D, Box2D, Box3D]>(); const components: OpenApi.IComponents = app.components as any; const plan2D: OpenApi.IJsonSchema = components.schemas!.Plan2D; diff --git a/test/features/openapi/test_json_schema_type_checker_cover_object.ts b/test/features/openapi/test_json_schema_type_checker_cover_object.ts index 488339a..375bd22 100644 --- a/test/features/openapi/test_json_schema_type_checker_cover_object.ts +++ b/test/features/openapi/test_json_schema_type_checker_cover_object.ts @@ -1,10 +1,10 @@ import { TestValidator } from "@nestia/e2e"; import { OpenApi, OpenApiTypeChecker } from "@samchon/openapi"; -import typia, { IJsonApplication } from "typia"; +import typia, { IJsonSchemaCollection } from "typia"; export const test_json_schema_type_checker_cover_object = (): void => { - const app: IJsonApplication = - typia.json.application<[Plan2D, Plan3D, Box2D, Box3D]>(); + const app: IJsonSchemaCollection = + typia.json.schemas<[Plan2D, Plan3D, Box2D, Box3D]>(); const components: OpenApi.IComponents = app.components as any; const plan2D: OpenApi.IJsonSchema = components.schemas!.Plan2D; diff --git a/test/features/openapi/test_json_schema_type_checker_cover_string.ts b/test/features/openapi/test_json_schema_type_checker_cover_string.ts index caaf161..7ceea5b 100644 --- a/test/features/openapi/test_json_schema_type_checker_cover_string.ts +++ b/test/features/openapi/test_json_schema_type_checker_cover_string.ts @@ -120,8 +120,8 @@ export const test_json_schema_type_checker_cover_string = (): void => { ); // CHECK FORMAT CASE - for (const x of typia.misc.literals()) - for (const y of typia.misc.literals()) + for (const x of typia.misc.literals()) + for (const y of typia.misc.literals()) TestValidator.equals(`format ${x} covers ${y}`)( x === y || (x === "idn-email" && y === "email") || From 064b374b6806648e9636a97e6708fd556e03a4bd Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Sun, 17 Nov 2024 01:50:55 +0900 Subject: [PATCH 2/2] Lock versions --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d3e0f9c..ab0a574 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,10 @@ }, "homepage": "https://github.com/samchon/openapi", "devDependencies": { - "@nestia/core": "^4.0.0-dev.20241116", - "@nestia/e2e": "^0.7.0", - "@nestia/fetcher": "^4.0.0-dev.20241116", - "@nestia/sdk": "^4.0.0-dev.20241116", + "@nestia/core": "4.0.0-dev.20241116", + "@nestia/e2e": "0.7.0", + "@nestia/fetcher": "4.0.0-dev.20241116", + "@nestia/sdk": "4.0.0-dev.20241116", "@nestjs/common": "^10.4.1", "@nestjs/core": "^10.4.1", "@nestjs/platform-express": "^10.4.1", @@ -56,7 +56,7 @@ "ts-patch": "^3.2.1", "typescript": "^5.6.3", "typescript-transform-paths": "^3.4.7", - "typia": "^7.0.0-dev.20241115", + "typia": "7.0.0-dev.20241115", "uuid": "^10.0.0" }, "sideEffects": false,