From 4136e6e7f3876e286147d25d7165b60ef7c3436e Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Thu, 26 Sep 2024 20:50:27 +0900 Subject: [PATCH] Allow only `validate.log` option and use `typia.json.validateStringify()` function. --- package.json | 2 +- packages/cli/package.json | 2 +- packages/cli/src/internal/PluginConfigurator.ts | 1 + packages/core/package.json | 6 +++--- packages/core/src/decorators/EncryptedRoute.ts | 6 +++--- packages/core/src/decorators/TypedRoute.ts | 11 ++++++++--- .../internal/get_path_and_stringify.ts | 9 ++++----- .../core/src/options/INestiaTransformOptions.ts | 1 - .../core/src/options/IResponseBodyStringifier.ts | 4 ++-- .../core/src/programmers/TypedRouteProgrammer.ts | 11 +---------- packages/fetcher/package.json | 2 +- packages/sdk/package.json | 10 +++++----- .../test/features/api/test_api_bbs_article_at.ts | 7 +++++++ .../swagger.json | 2 +- .../test/features/api/test_api_bbs_article_at.ts | 7 +++++++ .../swagger.json | 2 +- .../test/features/api/test_api_bbs_article_at.ts | 7 +++++++ .../route-manual-validate-log/swagger.json | 2 +- test/package.json | 8 ++++---- website/pages/docs/core/TypedRoute.mdx | 16 +++++++--------- website/pages/docs/setup.mdx | 1 - 21 files changed, 65 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 08f57d893..ebdbafcd9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@nestia/station", - "version": "3.15.0", + "version": "3.16.0", "description": "Nestia station", "scripts": { "build": "node build/index.js", diff --git a/packages/cli/package.json b/packages/cli/package.json index 5eab8ce66..a7a78c57b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "nestia", - "version": "6.1.0", + "version": "6.2.0", "description": "Nestia CLI tool", "main": "bin/index.js", "bin": { diff --git a/packages/cli/src/internal/PluginConfigurator.ts b/packages/cli/src/internal/PluginConfigurator.ts index c626d6be4..6ec63683e 100644 --- a/packages/cli/src/internal/PluginConfigurator.ts +++ b/packages/cli/src/internal/PluginConfigurator.ts @@ -93,6 +93,7 @@ export namespace PluginConfigurator { * - "assert": Use typia.assertStringify() function * - "is": Use typia.isStringify() function * - "validate": Use typia.validateStringify() function + * - "validate.log": typia.validateStringify(), but do not throw and just log it * - "stringify": Use typia.stringify() function, but dangerous * - null: Just use JSON.stringify() function, without boosting */ diff --git a/packages/core/package.json b/packages/core/package.json index 9fc09d47a..801f12ac7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/core", - "version": "3.15.0", + "version": "3.16.0", "description": "Super-fast validation decorators of NestJS", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -36,7 +36,7 @@ }, "homepage": "https://nestia.io", "dependencies": { - "@nestia/fetcher": "^3.15.0", + "@nestia/fetcher": "^3.16.0", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "@samchon/openapi": "^1.1.0", @@ -53,7 +53,7 @@ "ws": "^7.5.3" }, "peerDependencies": { - "@nestia/fetcher": ">=3.15.0", + "@nestia/fetcher": ">=3.16.0", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "reflect-metadata": ">=0.1.12", diff --git a/packages/core/src/decorators/EncryptedRoute.ts b/packages/core/src/decorators/EncryptedRoute.ts index 711121d05..87d56d526 100644 --- a/packages/core/src/decorators/EncryptedRoute.ts +++ b/packages/core/src/decorators/EncryptedRoute.ts @@ -95,9 +95,9 @@ export namespace EncryptedRoute { * instead of throwing the 400 bad request error. * * By the way, be careful. If you've configured the response - * transformation option to be `validate.log` or `validateEquals.log`, - * client may get wrong response data. Therefore, this way is not - * recommended in the common backend server case. + * transformation option to be `validate.log`, client may get wrong + * response data. Therefore, this way is not recommended in the common + * backend server case. * * @param func Logger function * @default console.log diff --git a/packages/core/src/decorators/TypedRoute.ts b/packages/core/src/decorators/TypedRoute.ts index 4b47f2c07..08215cda3 100644 --- a/packages/core/src/decorators/TypedRoute.ts +++ b/packages/core/src/decorators/TypedRoute.ts @@ -84,9 +84,9 @@ export namespace TypedRoute { * instead of throwing the 400 bad request error. * * By the way, be careful. If you've configured the response - * transformation option to be `validate.log` or `validateEquals.log`, - * client may get wrong response data. Therefore, this way is not - * recommendedin the common backend server case. + * transformation option to be `validate.log`, client may get wrong + * response data. Therefore, this way is not recommended in the common + * backend server case. * * @param func Logger function * @default console.log @@ -126,6 +126,11 @@ export namespace TypedRoute { * Validation error informations with detailed reasons. */ errors: IValidation.IError[]; + + /** + * Data that is not following the promised type `T`. + */ + data: unknown; } /** diff --git a/packages/core/src/decorators/internal/get_path_and_stringify.ts b/packages/core/src/decorators/internal/get_path_and_stringify.ts index fbbd367b1..a8e7bde7f 100644 --- a/packages/core/src/decorators/internal/get_path_and_stringify.ts +++ b/packages/core/src/decorators/internal/get_path_and_stringify.ts @@ -46,10 +46,7 @@ const take = else if (functor.type === "assert") return assert(functor.assert); else if (functor.type === "is") return is(functor.is); else if (functor.type === "validate") return validate(functor.validate); - else if ( - functor.type === "validate.log" || - functor.type === "validateEquals.log" - ) + else if (functor.type === "validate.log") return validateLog(logger)(functor.validate); throw new Error( `Error on nestia.core.${method}(): invalid typed stringify function.`, @@ -107,12 +104,14 @@ const validateLog = (logger: () => (log: TypedRoute.IValidateErrorLog) => void) => (closure: (data: T) => IValidation) => (data: T, method: string, path: string): string => { - const result: IValidation = closure(data); + const result: IValidation = closure(data); + if (result.success === true) return result.data; if (result.success === false) logger()({ errors: result.errors, method, path, + data, }); return JSON.stringify(data); }; diff --git a/packages/core/src/options/INestiaTransformOptions.ts b/packages/core/src/options/INestiaTransformOptions.ts index cd3a9fc80..595a6a874 100644 --- a/packages/core/src/options/INestiaTransformOptions.ts +++ b/packages/core/src/options/INestiaTransformOptions.ts @@ -19,7 +19,6 @@ export interface INestiaTransformOptions { | "is" | "validate" | "validate.log" - | "validateEquals.log" | null; throws?: boolean; } diff --git a/packages/core/src/options/IResponseBodyStringifier.ts b/packages/core/src/options/IResponseBodyStringifier.ts index 4f4aaf0a7..341bd07b1 100644 --- a/packages/core/src/options/IResponseBodyStringifier.ts +++ b/packages/core/src/options/IResponseBodyStringifier.ts @@ -24,7 +24,7 @@ export namespace IResponseBodyStringifier { validate: (input: T) => IValidation; } export interface IValidateLog { - type: "validate.log" | "validateEquals.log"; - validate: (input: T) => IValidation; + type: "validate.log"; + validate: (input: T) => IValidation; } } diff --git a/packages/core/src/programmers/TypedRouteProgrammer.ts b/packages/core/src/programmers/TypedRouteProgrammer.ts index 6818f455d..c4694ebe8 100644 --- a/packages/core/src/programmers/TypedRouteProgrammer.ts +++ b/packages/core/src/programmers/TypedRouteProgrammer.ts @@ -1,5 +1,4 @@ import ts from "typescript"; -import { ValidateProgrammer } from "typia/lib/programmers/ValidateProgrammer"; import { JsonAssertStringifyProgrammer } from "typia/lib/programmers/json/JsonAssertStringifyProgrammer"; import { JsonIsStringifyProgrammer } from "typia/lib/programmers/json/JsonIsStringifyProgrammer"; import { JsonStringifyProgrammer } from "typia/lib/programmers/json/JsonStringifyProgrammer"; @@ -60,15 +59,7 @@ export namespace TypedRouteProgrammer { return parameter({ type: "validate.log", key: "validate", - programmer: (project) => (modulo) => - ValidateProgrammer.write(project)(modulo)(false), - }); - else if (project.options.stringify === "validateEquals.log") - return parameter({ - type: "validateEquals.log", - key: "validate", - programmer: (project) => (modulo) => - ValidateProgrammer.write(project)(modulo)(true), + programmer: JsonValidateStringifyProgrammer.write, }); else if (project.options.stringify === null) return ts.factory.createNull(); diff --git a/packages/fetcher/package.json b/packages/fetcher/package.json index cbd8446d1..73a057afa 100644 --- a/packages/fetcher/package.json +++ b/packages/fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/fetcher", - "version": "3.15.0", + "version": "3.16.0", "description": "Fetcher library of Nestia SDK", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 64ab8d29c..180d3432d 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/sdk", - "version": "3.15.0", + "version": "3.16.0", "description": "Nestia SDK and Swagger generator", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -32,8 +32,8 @@ }, "homepage": "https://nestia.io", "dependencies": { - "@nestia/core": "^3.15.0", - "@nestia/fetcher": "^3.15.0", + "@nestia/core": "^3.16.0", + "@nestia/fetcher": "^3.16.0", "@samchon/openapi": "^1.1.0", "cli": "^1.0.1", "get-function-location": "^2.0.0", @@ -47,8 +47,8 @@ "typia": "^6.11.0" }, "peerDependencies": { - "@nestia/core": ">=3.15.0", - "@nestia/fetcher": ">=3.15.0", + "@nestia/core": ">=3.16.0", + "@nestia/fetcher": ">=3.16.0", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "reflect-metadata": ">=0.1.12", diff --git a/test/features/route-manual-validate-log-encrypted/src/test/features/api/test_api_bbs_article_at.ts b/test/features/route-manual-validate-log-encrypted/src/test/features/api/test_api_bbs_article_at.ts index 781b53fc2..8dccdaeb0 100644 --- a/test/features/route-manual-validate-log-encrypted/src/test/features/api/test_api_bbs_article_at.ts +++ b/test/features/route-manual-validate-log-encrypted/src/test/features/api/test_api_bbs_article_at.ts @@ -29,6 +29,13 @@ export const test_api_bbs_article_at = async ( ], method: "GET", path: `/bbs/articles/${id}`, + data: { + id, + title: "Hello, world!", + body: "This is a test article.", + thumbnail: null, + created_at: "wrong-data", + }, }, ]); }; diff --git a/test/features/route-manual-validate-log-encrypted/swagger.json b/test/features/route-manual-validate-log-encrypted/swagger.json index e92f2ae6a..1b09c057b 100644 --- a/test/features/route-manual-validate-log-encrypted/swagger.json +++ b/test/features/route-manual-validate-log-encrypted/swagger.json @@ -1 +1 @@ -{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.15.0-dev.20240926","title":"@samchon/nestia-test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/bbs/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{}}}}}}},"components":{"schemas":{"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"body":{"type":"string"},"thumbnail":{"oneOf":[{"type":"null"},{"type":"string","format":"uri","contentMediaType":"image/*"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","body","thumbnail","created_at"]}},"securitySchemes":{"bearer":{"type":"apiKey"}}},"tags":[],"x-samchon-emended":true} \ No newline at end of file +{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.16.0-dev.20240926","title":"@samchon/nestia-test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/bbs/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{}}}}}}},"components":{"schemas":{"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"body":{"type":"string"},"thumbnail":{"oneOf":[{"type":"null"},{"type":"string","format":"uri","contentMediaType":"image/*"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","body","thumbnail","created_at"]}},"securitySchemes":{"bearer":{"type":"apiKey"}}},"tags":[],"x-samchon-emended":true} \ No newline at end of file diff --git a/test/features/route-manual-validate-log-fastify/src/test/features/api/test_api_bbs_article_at.ts b/test/features/route-manual-validate-log-fastify/src/test/features/api/test_api_bbs_article_at.ts index 781b53fc2..8dccdaeb0 100644 --- a/test/features/route-manual-validate-log-fastify/src/test/features/api/test_api_bbs_article_at.ts +++ b/test/features/route-manual-validate-log-fastify/src/test/features/api/test_api_bbs_article_at.ts @@ -29,6 +29,13 @@ export const test_api_bbs_article_at = async ( ], method: "GET", path: `/bbs/articles/${id}`, + data: { + id, + title: "Hello, world!", + body: "This is a test article.", + thumbnail: null, + created_at: "wrong-data", + }, }, ]); }; diff --git a/test/features/route-manual-validate-log-fastify/swagger.json b/test/features/route-manual-validate-log-fastify/swagger.json index e92f2ae6a..1b09c057b 100644 --- a/test/features/route-manual-validate-log-fastify/swagger.json +++ b/test/features/route-manual-validate-log-fastify/swagger.json @@ -1 +1 @@ -{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.15.0-dev.20240926","title":"@samchon/nestia-test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/bbs/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{}}}}}}},"components":{"schemas":{"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"body":{"type":"string"},"thumbnail":{"oneOf":[{"type":"null"},{"type":"string","format":"uri","contentMediaType":"image/*"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","body","thumbnail","created_at"]}},"securitySchemes":{"bearer":{"type":"apiKey"}}},"tags":[],"x-samchon-emended":true} \ No newline at end of file +{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.16.0-dev.20240926","title":"@samchon/nestia-test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/bbs/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{}}}}}}},"components":{"schemas":{"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"body":{"type":"string"},"thumbnail":{"oneOf":[{"type":"null"},{"type":"string","format":"uri","contentMediaType":"image/*"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","body","thumbnail","created_at"]}},"securitySchemes":{"bearer":{"type":"apiKey"}}},"tags":[],"x-samchon-emended":true} \ No newline at end of file diff --git a/test/features/route-manual-validate-log/src/test/features/api/test_api_bbs_article_at.ts b/test/features/route-manual-validate-log/src/test/features/api/test_api_bbs_article_at.ts index 781b53fc2..8dccdaeb0 100644 --- a/test/features/route-manual-validate-log/src/test/features/api/test_api_bbs_article_at.ts +++ b/test/features/route-manual-validate-log/src/test/features/api/test_api_bbs_article_at.ts @@ -29,6 +29,13 @@ export const test_api_bbs_article_at = async ( ], method: "GET", path: `/bbs/articles/${id}`, + data: { + id, + title: "Hello, world!", + body: "This is a test article.", + thumbnail: null, + created_at: "wrong-data", + }, }, ]); }; diff --git a/test/features/route-manual-validate-log/swagger.json b/test/features/route-manual-validate-log/swagger.json index e92f2ae6a..1b09c057b 100644 --- a/test/features/route-manual-validate-log/swagger.json +++ b/test/features/route-manual-validate-log/swagger.json @@ -1 +1 @@ -{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.15.0-dev.20240926","title":"@samchon/nestia-test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/bbs/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{}}}}}}},"components":{"schemas":{"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"body":{"type":"string"},"thumbnail":{"oneOf":[{"type":"null"},{"type":"string","format":"uri","contentMediaType":"image/*"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","body","thumbnail","created_at"]}},"securitySchemes":{"bearer":{"type":"apiKey"}}},"tags":[],"x-samchon-emended":true} \ No newline at end of file +{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.16.0-dev.20240926","title":"@samchon/nestia-test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/bbs/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{}}}}}}},"components":{"schemas":{"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"body":{"type":"string"},"thumbnail":{"oneOf":[{"type":"null"},{"type":"string","format":"uri","contentMediaType":"image/*"}]},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","body","thumbnail","created_at"]}},"securitySchemes":{"bearer":{"type":"apiKey"}}},"tags":[],"x-samchon-emended":true} \ No newline at end of file diff --git a/test/package.json b/test/package.json index 325cdc971..67c7c6e9f 100644 --- a/test/package.json +++ b/test/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@samchon/nestia-test", - "version": "3.15.0", + "version": "3.16.0", "description": "Test program of Nestia", "main": "index.js", "scripts": { @@ -26,7 +26,7 @@ }, "homepage": "https://nestia.io", "devDependencies": { - "@nestia/sdk": "^3.15.0", + "@nestia/sdk": "^3.16.0", "@nestjs/swagger": "^7.4.2", "@samchon/openapi": "^1.1.0", "@types/express": "^4.17.17", @@ -40,9 +40,9 @@ }, "dependencies": { "@fastify/multipart": "^8.1.0", - "@nestia/core": "^3.15.0", + "@nestia/core": "^3.16.0", "@nestia/e2e": "^0.7.0", - "@nestia/fetcher": "^3.15.0", + "@nestia/fetcher": "^3.16.0", "@nestjs/common": "^10.4.4", "@nestjs/core": "^10.4.4", "@nestjs/platform-express": "^10.4.4", diff --git a/website/pages/docs/core/TypedRoute.mdx b/website/pages/docs/core/TypedRoute.mdx index c76aac89e..636cb7c10 100644 --- a/website/pages/docs/core/TypedRoute.mdx +++ b/website/pages/docs/core/TypedRoute.mdx @@ -551,12 +551,11 @@ For reference, such encryption spec is not supported in the [Swagger-UI](../sdk/ { "transform": "@nestia/core/lib/transform", "stringify": "assert", - // "stringify": typia.stringify without validation - // "assert": typia.assertStringify - // "is": typia.isStringify - // "validate": typia.validateStringify - // "validate.log": do not throw error, just log - // "validateEquals".log: do not throw error, just log + // "assert": typia.assertStringify() + // "is": typia.isStringify() + // "validate": typia.validateStringify() + // "validate.log": typia.validateStringify(), but do not throw error and just log it + // "stringify": typia.stringify() without validation } ] } @@ -573,13 +572,12 @@ Here is the list of available options. - `assert`: [`typia.json.assertStringify()`](https://typia.io/docs/json/stringify/) - `is`: [`typia.json.isStringify()`](https://typia.io/docs/json/stringify/) - `validate`: [`typia.json.validateStringify()`](https://typia.io/docs/json/stringify/) + - `validate.log`: [`typia.json.validateStringify()`](https://typia.io/docs/json/stringify/), but do not throw error and just log it - `null`: just use `JSON.stringify()` function without validation - - `validate.log`: do not throw error, but just log by [`typia.validate()`](https://typia.io/docs/validators/validate/) - - `validateEquals.log`: do not throw error, but just log by [`typia.validateEquals()`](https://typia.io/docs/validators/validate/#validateequals-function) By the way, this is not a recommended way, but you can skip the response type validation for. If you set the `stringify` property to `null`, the response type validation will be skipped and just `JSON.stringify()` function be used. -Also, `validate.log` and `validateEquals.log` perform the validation, but do not throw 500 internal server error. When type error be detected, it seralizes response data by `JSON.stringify()` function, and logs the error message to the console or somewhere you've specified. It is useful when you want to know the error message, but do not want to throw 500 internal server error to the client application. +Also, `validate.log` performs the validation, but does not throw 500 internal server error. When type error be detected, it seralizes response data by `JSON.stringify()` function, and logs the error message to the console or somewhere you've specified. It is useful when you want to know the error message, but do not want to throw 500 internal server error to the client application. ```typescript TypedRoute.setValidateErrorLogger((err: TypedRoute.IValidateErrorLog) => { diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index ac047d116..19ad0cd16 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -443,7 +443,6 @@ As `@nestia/core` and `typia` are generating optimal validation and JSON seriali - [`assertClone`](https://typia.io/docs/misc/#clone-functions) or [`validateClone`](https://typia.io/docs/misc/#clone-functions): deep clone with type checking for faster pruning - Only for `stringify` - [`validate.log`](https://typia.io/docs/validators/validate/): check response data, but do not throw error and just log it - - [`validateEquals.log`](https://typia.io/docs/validators/validate/#validateequals-function): check response data, but do not throw error and just log it Also, never forget to configure `strict` (or `strictNullChecks`) as `true`. It is essential option for modern TypeScript development.