Skip to content

Commit

Permalink
Merge pull request #653 from samchon/features/json
Browse files Browse the repository at this point in the history
Ban `Map` types in JSON related functions.
  • Loading branch information
samchon authored Oct 12, 2023
2 parents 18dcb2c + 0130cc5 commit d7df724
Show file tree
Hide file tree
Showing 44 changed files with 214 additions and 161 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Check out the document in the [website](https://nestia.io/docs/):
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
- [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
- [TypedQuery](https://nestia.io/docs/core/TypedQuery/)
- [TypedHeaders](https://nestia.io/docs/core/TypedHeaders/)
- [TypedException](https://nestia.io/docs/core/TypedException/)
- Generators
Expand Down
4 changes: 2 additions & 2 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/core": "^2.0.5-dev.20230921",
"typia": "^5.2.1"
"@nestia/core": "^2.2.1-dev.20231012",
"typia": "^5.2.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@types/node": "^18.11.16",
"prettier": "^2.8.7",
"rimraf": "^3.0.2",
"typescript": "^5.2.1"
"typescript": "^5.2.2"
},
"files": [
"bin",
Expand Down
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "2.2.1",
"version": "2.2.2",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^2.2.1",
"@nestia/fetcher": "^2.2.2",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@nestjs/platform-express": ">=7.0.1",
Expand All @@ -44,10 +44,10 @@
"raw-body": ">=2.0.0",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.0",
"typia": ">=5.2.1 <6.0.0"
"typia": ">=5.2.2 <6.0.0"
},
"peerDependencies": {
"@nestia/fetcher": ">=2.2.1",
"@nestia/fetcher": ">=2.2.2",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@nestjs/platform-express": ">=7.0.1",
Expand All @@ -56,7 +56,7 @@
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.0",
"typescript": ">=4.8.0",
"typia": ">=5.2.1 <6.0.0"
"typia": ">=5.2.2 <6.0.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ts-node": "^10.9.1",
"ts-patch": "^3.0.2",
"typescript": "^5.2.2",
"typia": "^5.2.1"
"typia": "^5.2.2"
},
"dependencies": {
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "2.2.1",
"version": "2.2.2",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/fetcher/src/Primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* `String` | `string`
* `Class` | `object`
* `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
* Native Class | `{}`
* Native Class | never
* Others | No change
*
* @template Instance Target argument type.
Expand All @@ -49,7 +49,7 @@ type PrimitiveMain<Instance> = Instance extends [never]
: ValueOf<Instance> extends object
? Instance extends object
? Instance extends NativeClass
? {}
? never
: Instance extends IJsonable<infer Raw>
? ValueOf<Raw> extends object
? Raw extends object
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"typia": "^5.2.1"
"typia": "^5.2.2"
},
"files": [
"lib",
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "2.2.1",
"version": "2.2.2",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^2.2.1",
"@nestia/fetcher": "^2.2.2",
"cli": "^1.0.1",
"glob": "^7.2.0",
"path-to-regexp": "^6.2.1",
Expand All @@ -44,16 +44,16 @@
"tsconfck": "^2.0.1",
"tsconfig-paths": "^4.1.1",
"tstl": "^2.5.13",
"typia": "^5.2.1"
"typia": "^5.2.2"
},
"peerDependencies": {
"@nestia/fetcher": ">=2.2.1",
"@nestia/fetcher": ">=2.2.2",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"ts-node": ">=10.6.0",
"typescript": ">=4.8.0",
"typia": ">=5.2.1 <6.0.0"
"typia": ">=5.2.2 <6.0.0"
},
"devDependencies": {
"@nestjs/common": ">= 7.0.1",
Expand Down
10 changes: 0 additions & 10 deletions test/features/body-error-bigint/src/controllers/BodyController.ts

This file was deleted.

10 changes: 10 additions & 0 deletions test/features/body-error-json/src/api/structures/IBbsArticle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export namespace IBbsArticle {
export interface IUpdate {
sequence: bigint;
keywords: Set<string>;
dictionary: Map<string, string>;
images: Uint8Array[];
buffer: ArrayBuffer;
weak: WeakMap<object, string>;
}
}
17 changes: 17 additions & 0 deletions test/features/body-error-json/src/controllers/BodyController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import core from "@nestia/core";
import { Controller } from "@nestjs/common";
import { tags } from "typia";

import { IBbsArticle } from "../api/structures/IBbsArticle";

@Controller("bbs/articles")
export class BbsArticlesController {
@core.TypedRoute.Post(":id")
public update(
@core.TypedParam("id") id: string & tags.Format<"uuid">,
@core.TypedBody() input: IBbsArticle.IUpdate,
): void {
id;
input;
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { Format } from "typia/lib/tags/Format";

/**
* Make all properties in T optional
*/
export type PartialPickIOriginaldemailcreated_atoriginal_optionalundefinable_attr = {
d?: undefined | string;
email?: null | undefined | (string & Format<"email">);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { Format } from "typia/lib/tags/Format";

/**
* Make all properties in T optional
*/
export type PartialPickIOriginalemailcreated_atoriginal_optionalundefinable_attrb = {
email?: null | undefined | (string & Format<"email">);
created_at?: null | undefined | (string & Format<"date-time">);
Expand Down
2 changes: 2 additions & 0 deletions test/features/clone-and-exact-optional-property/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@
}
},
"nullable": false,
"description": "Make all properties in T optional",
"x-typia-jsDocTags": []
},
"PartialPickIOriginalemailcreated_atoriginal_optionalundefinable_attrb": {
Expand Down Expand Up @@ -492,6 +493,7 @@
}
},
"nullable": false,
"description": "Make all properties in T optional",
"x-typia-jsDocTags": []
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type ISwaggerRoute = {
}
export namespace ISwaggerRoute {
export type IResponseBody = {
[key: string]: __type.o3;
[key: string]: __type.o4;
}
export type IParameter = {
name: string;
Expand All @@ -35,7 +35,8 @@ export namespace ISwaggerRoute {
"x-nestia-encrypted": boolean;
}
export type IContent = {
"application/json"?: undefined | __type.o1;
"text/plain"?: undefined | __type.o2;
"application/x-www-form-urlencoded"?: undefined | __type.o1;
"application/json"?: undefined | __type.o2;
"text/plain"?: undefined | __type.o3;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import type { Recordstringstring } from "./Recordstringstring";

export namespace OmitISwaggerSecurityScheme {
export namespace IOAuth2 {
/**
* Construct a type with the properties of T except for those in type K.
*/
export type IFlowtokenUrl = {
authorizationUrl: string;
refreshUrl: string;
scopes?: undefined | Recordstringstring;
}
/**
* Construct a type with the properties of T except for those in type K.
*/
export type IFlowauthorizationUrl = {
tokenUrl: string;
refreshUrl: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { Format } from "typia/lib/tags/Format";

/**
* Make all properties in T optional
*/
export type PartialPickIUsernameemailnullable_attroptional_attr = {
name?: undefined | string;
email?: null | undefined | (string & Format<"email">);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Construct a type with a set of properties K of type T
*/
export type RecordstringArraystring = {
[key: string]: Array<string>;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { IJsonSchema } from "./IJsonSchema";

/**
* Construct a type with a set of properties K of type T
*/
export type RecordstringIJsonSchema = {
[key: string]: IJsonSchema;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import type { IStringIIdentified } from "./IStringIIdentified";
import type { ITupleIIdentified } from "./ITupleIIdentified";
import type { IUnknownIIdentified } from "./IUnknownIIdentified";

/**
* Construct a type with a set of properties K of type T
*/
export type RecordstringIObjectIAlias = {
[key: string]: IJsonComponents.IObject | IEnumerationbooleanIIdentified | IEnumerationnumberIIdentified | IEnumerationstringIIdentified | IBooleanIIdentified | IIntegerIIdentified | INumberIIdentified | IStringIIdentified | IArrayIIdentified | ITupleIIdentified | IOneOfIIdentified | IReferenceIIdentified | INullOnlyIIdentified | IUnknownIIdentified;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { ISwaggerRoute } from "./ISwaggerRoute";

/**
* Construct a type with a set of properties K of type T
*/
export type RecordstringISwaggerRoute = {
[key: string]: ISwaggerRoute;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";

/**
* Construct a type with a set of properties K of type T
*/
export type RecordstringISwaggerSecurityScheme = {
[key: string]: ISwaggerSecurityScheme;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { RecordstringISwaggerRoute } from "./RecordstringISwaggerRoute";

/**
* Construct a type with a set of properties K of type T
*/
export type RecordstringRecordstringISwaggerRoute = {
[key: string]: RecordstringISwaggerRoute;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Construct a type with a set of properties K of type T
*/
export type Recordstringstring = {
[key: string]: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export namespace __type {
schema: IJsonSchema;
}
export type o3 = {
schema: IJsonSchema;
}
export type o4 = {
description: string;
content?: undefined | ISwaggerRoute.IContent;
"x-nestia-encrypted"?: undefined | boolean;
Expand Down
Loading

0 comments on commit d7df724

Please sign in to comment.