ts-class-to-openapi 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +976 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.mts +58 -0
- package/dist/index.mjs +951 -0
- package/package.json +32 -28
- package/dist/__test__/entities/additional-test-classes.d.ts +0 -12
- package/dist/__test__/entities/circular-reference-cases.d.ts +0 -1
- package/dist/__test__/entities/circular-reference-classes.d.ts +0 -110
- package/dist/__test__/entities/collision/arrays/number-array.d.ts +0 -3
- package/dist/__test__/entities/collision/arrays/string-array.d.ts +0 -3
- package/dist/__test__/entities/collision/number-props/same-name.d.ts +0 -5
- package/dist/__test__/entities/collision/string-props/same-name.d.ts +0 -5
- package/dist/__test__/entities/collision/throwing/class-a.d.ts +0 -4
- package/dist/__test__/entities/collision/throwing/class-b.d.ts +0 -4
- package/dist/__test__/entities/complex-circular-dependencies.d.ts +0 -71
- package/dist/__test__/entities/decorated-classes.d.ts +0 -54
- package/dist/__test__/entities/deep-nested-classes.d.ts +0 -1
- package/dist/__test__/entities/enum-classes.d.ts +0 -38
- package/dist/__test__/entities/evaluation/generics.d.ts +0 -6
- package/dist/__test__/entities/evaluation/modifiers.d.ts +0 -7
- package/dist/__test__/entities/generic-circular-classes.d.ts +0 -57
- package/dist/__test__/entities/nested-classes.d.ts +0 -70
- package/dist/__test__/entities/nested-reuse-classes.d.ts +0 -43
- package/dist/__test__/entities/pure-classes.d.ts +0 -37
- package/dist/__test__/entities/schema-validation-classes.d.ts +0 -35
- package/dist/__test__/index.d.ts +0 -8
- package/dist/__test__/test.d.ts +0 -1
- package/dist/__test__/testCases/collision-advanced.test.d.ts +0 -1
- package/dist/__test__/testCases/collision.test.d.ts +0 -1
- package/dist/__test__/testCases/decorated-classes.test.d.ts +0 -1
- package/dist/__test__/testCases/edge-cases.test.d.ts +0 -1
- package/dist/__test__/testCases/enum-properties.test.d.ts +0 -1
- package/dist/__test__/testCases/generics-and-modifiers.test.d.ts +0 -1
- package/dist/__test__/testCases/nested-classes.test.d.ts +0 -1
- package/dist/__test__/testCases/nested-reuse.test.d.ts +0 -1
- package/dist/__test__/testCases/pure-classes.test.d.ts +0 -1
- package/dist/__test__/testCases/schema-validation.test.d.ts +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.esm.js +0 -1230
- package/dist/index.js +0 -1232
- package/dist/run.d.ts +0 -1
- package/dist/run.js +0 -1319
- package/dist/transformer.d.ts +0 -5
- package/dist/transformer.fixtures.d.ts +0 -175
- package/dist/types.d.ts +0 -97
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-class-to-openapi",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Transform TypeScript classes into OpenAPI 3.1.0 schema objects, which support class-validator decorators",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.mts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"files": [
|
|
@@ -18,18 +23,6 @@
|
|
|
18
23
|
"README.md",
|
|
19
24
|
"LICENSE"
|
|
20
25
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"test": "npm run build:test && node --test dist/test.js",
|
|
23
|
-
"test:watch": "npm run build:test && node --test --watch dist/**/*.test.js",
|
|
24
|
-
"test:coverage": "npm run build:test && node --test --experimental-test-coverage dist/**/*.test.js",
|
|
25
|
-
"build": "rm -rf dist && rollup -c",
|
|
26
|
-
"build:test": "rm -rf dist && BUILD_TARGET=test rollup -c",
|
|
27
|
-
"build:watch": "rm -rf dist && rollup -c -w",
|
|
28
|
-
"dev": "node --trace-deprecation --watch dist/run.js",
|
|
29
|
-
"format": "prettier --write .",
|
|
30
|
-
"format:check": "prettier --check .",
|
|
31
|
-
"prepublish": "pnpm run build"
|
|
32
|
-
},
|
|
33
26
|
"repository": {
|
|
34
27
|
"type": "git",
|
|
35
28
|
"url": "git+https://github.com/julioolivares/ts-class-to-openapi.git"
|
|
@@ -65,7 +58,7 @@
|
|
|
65
58
|
},
|
|
66
59
|
"engineStrict": true,
|
|
67
60
|
"peerDependencies": {
|
|
68
|
-
"class-validator": "0.
|
|
61
|
+
"class-validator": "0.15.1"
|
|
69
62
|
},
|
|
70
63
|
"peerDependenciesMeta": {
|
|
71
64
|
"class-validator": {
|
|
@@ -73,15 +66,26 @@
|
|
|
73
66
|
}
|
|
74
67
|
},
|
|
75
68
|
"dependencies": {
|
|
76
|
-
"
|
|
77
|
-
"
|
|
69
|
+
"class-validator": "0.15.1",
|
|
70
|
+
"typescript": "6.0.2"
|
|
78
71
|
},
|
|
79
72
|
"devDependencies": {
|
|
80
|
-
"@rollup/plugin-typescript": "12.1.4",
|
|
81
73
|
"@types/node": "24.2.1",
|
|
82
74
|
"prettier": "3.6.2",
|
|
83
|
-
"
|
|
84
|
-
"tslib": "2.8.1"
|
|
75
|
+
"tsdown": "0.21.4",
|
|
76
|
+
"tslib": "2.8.1",
|
|
77
|
+
"tsx": "4.21.0"
|
|
85
78
|
},
|
|
86
|
-
"package": "./package-dist.json"
|
|
87
|
-
|
|
79
|
+
"package": "./package-dist.json",
|
|
80
|
+
"scripts": {
|
|
81
|
+
"test": "node --import tsx --test test/testCases/**/*.test.ts",
|
|
82
|
+
"test:watch": "node --import tsx --inspect --test --watch test/testCases/**/*.test.ts",
|
|
83
|
+
"test:coverage": "node --import tsx --test --experimental-test-coverage test/testCases/**/*.test.ts",
|
|
84
|
+
"build": "tsc --noEmit && rm -rf dist && tsdown",
|
|
85
|
+
"build:watch": "rm -rf dist && tsdown --watch",
|
|
86
|
+
"dev": "node --import tsx --test --inspect --watch ./src/run.ts",
|
|
87
|
+
"format": "prettier --write .",
|
|
88
|
+
"format:check": "prettier --check .",
|
|
89
|
+
"prepublish": "pnpm build"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Additional test classes for pure TypeScript classes tests
|
|
3
|
-
* These classes are used in the pure-classes.test.ts file
|
|
4
|
-
*/
|
|
5
|
-
export declare class OptionalOnlyClass {
|
|
6
|
-
optionalProp?: string;
|
|
7
|
-
anotherOptional?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare class UnionTypeClass {
|
|
10
|
-
stringOrNumber: string | number;
|
|
11
|
-
optionalUnion?: boolean | string;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test classes for circular reference scenarios
|
|
3
|
-
* These classes are designed to test the handling of recursive references
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Self-referencing class through direct property
|
|
7
|
-
*/
|
|
8
|
-
export declare class SelfReferenceDirectClass {
|
|
9
|
-
id: number;
|
|
10
|
-
name: string;
|
|
11
|
-
parent?: SelfReferenceDirectClass;
|
|
12
|
-
children: SelfReferenceDirectClass[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Metadata class for nested circular references
|
|
16
|
-
*/
|
|
17
|
-
export declare class NestedMetadata {
|
|
18
|
-
createdBy?: SelfReferenceNestedClass;
|
|
19
|
-
modifiedBy?: SelfReferenceNestedClass;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Self-referencing class through nested property
|
|
23
|
-
*/
|
|
24
|
-
export declare class SelfReferenceNestedClass {
|
|
25
|
-
id: number;
|
|
26
|
-
metadata: NestedMetadata;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Second class in indirect circular reference
|
|
30
|
-
*/
|
|
31
|
-
export declare class NodeDataClass {
|
|
32
|
-
description: string;
|
|
33
|
-
parentNode: NodeClass;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* First class in indirect circular reference
|
|
37
|
-
*/
|
|
38
|
-
export declare class NodeClass {
|
|
39
|
-
id: number;
|
|
40
|
-
name: string;
|
|
41
|
-
nodeData: NodeDataClass;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Third class in deep circular chain
|
|
45
|
-
*/
|
|
46
|
-
export declare class ClassC {
|
|
47
|
-
id: number;
|
|
48
|
-
value: number;
|
|
49
|
-
nextRef: ClassA;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Second class in deep circular chain
|
|
53
|
-
*/
|
|
54
|
-
export declare class ClassB {
|
|
55
|
-
id: number;
|
|
56
|
-
description: string;
|
|
57
|
-
nextRef: ClassC;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* First class in deep circular chain
|
|
61
|
-
*/
|
|
62
|
-
export declare class ClassA {
|
|
63
|
-
id: number;
|
|
64
|
-
name: string;
|
|
65
|
-
nextRef: ClassB;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Multiple circular paths in the same class
|
|
69
|
-
*/
|
|
70
|
-
export declare class MultiPathCircularClass {
|
|
71
|
-
id: number;
|
|
72
|
-
selfRef1?: MultiPathCircularClass;
|
|
73
|
-
selfRef2?: MultiPathCircularClass;
|
|
74
|
-
manyRefs: MultiPathCircularClass[];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Base generic class that can create circular references
|
|
78
|
-
*/
|
|
79
|
-
export declare class GenericContainer {
|
|
80
|
-
value: any;
|
|
81
|
-
metadata: Record<string, any>;
|
|
82
|
-
related?: GenericContainer;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Concrete implementation with self-reference
|
|
86
|
-
*/
|
|
87
|
-
export declare class SelfReferencingGenericClass extends GenericContainer {
|
|
88
|
-
id: number;
|
|
89
|
-
name: string;
|
|
90
|
-
children: SelfReferencingGenericClass;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Classes for deeply nested circular references
|
|
94
|
-
*/
|
|
95
|
-
export declare class Level3 {
|
|
96
|
-
data: boolean;
|
|
97
|
-
refToRoot?: DeepNestedProperClasses;
|
|
98
|
-
}
|
|
99
|
-
export declare class Level2 {
|
|
100
|
-
data: number;
|
|
101
|
-
level3: Level3;
|
|
102
|
-
}
|
|
103
|
-
export declare class Level1 {
|
|
104
|
-
data: string;
|
|
105
|
-
level2: Level2;
|
|
106
|
-
}
|
|
107
|
-
export declare class DeepNestedProperClasses {
|
|
108
|
-
id: number;
|
|
109
|
-
level1: Level1;
|
|
110
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Complex inter-dependent classes with multiple circular references
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Core entity with relationships to other classes
|
|
6
|
-
*/
|
|
7
|
-
export declare class User {
|
|
8
|
-
id: number;
|
|
9
|
-
name: string;
|
|
10
|
-
email: string;
|
|
11
|
-
posts: Post[];
|
|
12
|
-
comments: Comment[];
|
|
13
|
-
profile: Profile;
|
|
14
|
-
primaryGroup?: Group;
|
|
15
|
-
manager?: User;
|
|
16
|
-
directReports: User[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Entity with back-reference to User
|
|
20
|
-
*/
|
|
21
|
-
export declare class Post {
|
|
22
|
-
id: number;
|
|
23
|
-
title: string;
|
|
24
|
-
content: string;
|
|
25
|
-
author: User;
|
|
26
|
-
comments: Comment[];
|
|
27
|
-
categories: Category[];
|
|
28
|
-
relatedPosts: Post[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Entity with multiple back-references creating complex circular dependencies
|
|
32
|
-
*/
|
|
33
|
-
export declare class Comment {
|
|
34
|
-
id: number;
|
|
35
|
-
content: string;
|
|
36
|
-
author: User;
|
|
37
|
-
post: Post;
|
|
38
|
-
parentComment?: Comment;
|
|
39
|
-
replies: Comment[];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Entity with 1:1 relationship with User
|
|
43
|
-
*/
|
|
44
|
-
export declare class Profile {
|
|
45
|
-
id: number;
|
|
46
|
-
bio: string;
|
|
47
|
-
avatar: string;
|
|
48
|
-
user: User;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Entity with many-to-many relationship with User
|
|
52
|
-
*/
|
|
53
|
-
export declare class Group {
|
|
54
|
-
id: number;
|
|
55
|
-
name: string;
|
|
56
|
-
description: string;
|
|
57
|
-
members: User[];
|
|
58
|
-
admin: User;
|
|
59
|
-
parentGroup?: Group;
|
|
60
|
-
subGroups: Group[];
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Entity with many-to-many relationship with Post
|
|
64
|
-
*/
|
|
65
|
-
export declare class Category {
|
|
66
|
-
id: number;
|
|
67
|
-
name: string;
|
|
68
|
-
posts: Post[];
|
|
69
|
-
parentCategory?: Category;
|
|
70
|
-
subcategories: Category[];
|
|
71
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export declare enum UserStatus {
|
|
2
|
-
ACTIVE = "active",
|
|
3
|
-
INACTIVE = "inactive",
|
|
4
|
-
PENDING = "pending",
|
|
5
|
-
SUSPENDED = "suspended"
|
|
6
|
-
}
|
|
7
|
-
export declare enum Priority {
|
|
8
|
-
LOW = 1,
|
|
9
|
-
MEDIUM = 2,
|
|
10
|
-
HIGH = 3,
|
|
11
|
-
CRITICAL = 4
|
|
12
|
-
}
|
|
13
|
-
export declare class DecoratedAddress {
|
|
14
|
-
street: string;
|
|
15
|
-
city: string;
|
|
16
|
-
state: string;
|
|
17
|
-
zipCode: string;
|
|
18
|
-
country: string;
|
|
19
|
-
}
|
|
20
|
-
export declare class DecoratedUser {
|
|
21
|
-
id: number;
|
|
22
|
-
name: string;
|
|
23
|
-
email: string;
|
|
24
|
-
age: number;
|
|
25
|
-
status: UserStatus;
|
|
26
|
-
isActive?: boolean;
|
|
27
|
-
tags: string[];
|
|
28
|
-
address: DecoratedAddress;
|
|
29
|
-
createdAt: Date;
|
|
30
|
-
updatedAt?: Date;
|
|
31
|
-
}
|
|
32
|
-
export declare class DecoratedProduct {
|
|
33
|
-
id: number;
|
|
34
|
-
name: string;
|
|
35
|
-
description: string;
|
|
36
|
-
price: number;
|
|
37
|
-
currency: string;
|
|
38
|
-
categories: string[];
|
|
39
|
-
inStock: boolean;
|
|
40
|
-
quantity?: number;
|
|
41
|
-
images?: string[];
|
|
42
|
-
}
|
|
43
|
-
export declare class DecoratedTask {
|
|
44
|
-
id: number;
|
|
45
|
-
title: string;
|
|
46
|
-
description: string;
|
|
47
|
-
priority: Priority;
|
|
48
|
-
completed: boolean;
|
|
49
|
-
dueDate: Date;
|
|
50
|
-
assignedTo?: DecoratedUser;
|
|
51
|
-
tags?: string[];
|
|
52
|
-
createdAt: Date;
|
|
53
|
-
completedAt?: Date;
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export declare enum UserRole {
|
|
2
|
-
ADMIN = "admin",
|
|
3
|
-
USER = "user",
|
|
4
|
-
GUEST = "guest"
|
|
5
|
-
}
|
|
6
|
-
export declare enum OrderStatus {
|
|
7
|
-
PENDING = 0,
|
|
8
|
-
PROCESSING = 1,
|
|
9
|
-
SHIPPED = 2,
|
|
10
|
-
DELIVERED = 3,
|
|
11
|
-
CANCELLED = 4
|
|
12
|
-
}
|
|
13
|
-
export declare enum MixedEnum {
|
|
14
|
-
YES = "yes",
|
|
15
|
-
NO = 0
|
|
16
|
-
}
|
|
17
|
-
export declare class EnumTestEntity {
|
|
18
|
-
role: UserRole;
|
|
19
|
-
status: OrderStatus;
|
|
20
|
-
mixed: MixedEnum;
|
|
21
|
-
}
|
|
22
|
-
export declare class ArrayEnumTestEntity {
|
|
23
|
-
roles: UserRole[];
|
|
24
|
-
statuses: OrderStatus[];
|
|
25
|
-
files: UploadFileDto[];
|
|
26
|
-
}
|
|
27
|
-
declare class UploadFileDto {
|
|
28
|
-
name: string;
|
|
29
|
-
type: string;
|
|
30
|
-
size: number;
|
|
31
|
-
}
|
|
32
|
-
export declare class PureEnumTestEntity {
|
|
33
|
-
role: UserRole;
|
|
34
|
-
status: OrderStatus;
|
|
35
|
-
mixed: MixedEnum;
|
|
36
|
-
files?: UploadFileDto[];
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interfaces and classes for handling generic circular references
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Interface defining the contract for metadata properties
|
|
6
|
-
*/
|
|
7
|
-
export interface IMetadata {
|
|
8
|
-
createdAt?: Date;
|
|
9
|
-
updatedAt?: Date;
|
|
10
|
-
version?: number;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Interface defining the contract for entities with circular references
|
|
15
|
-
*/
|
|
16
|
-
export interface ICircularReference<T> {
|
|
17
|
-
getReference(): T | undefined;
|
|
18
|
-
setReference(ref: T): void;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Interface for entities that can contain related items
|
|
22
|
-
*/
|
|
23
|
-
export interface IRelatable<T> {
|
|
24
|
-
related?: T;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Base class for containers that hold generic values with metadata
|
|
28
|
-
*/
|
|
29
|
-
export declare abstract class BaseContainer<T> implements IRelatable<BaseContainer<T>> {
|
|
30
|
-
abstract value: T;
|
|
31
|
-
metadata: IMetadata;
|
|
32
|
-
related?: BaseContainer<T>;
|
|
33
|
-
constructor();
|
|
34
|
-
protected abstract validateValue(value: T): boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Generic container implementation with basic value validation
|
|
38
|
-
*/
|
|
39
|
-
export declare class GenericContainer<T> extends BaseContainer<T> {
|
|
40
|
-
value: T;
|
|
41
|
-
metadata: IMetadata & {
|
|
42
|
-
additionalInfo?: string;
|
|
43
|
-
};
|
|
44
|
-
constructor(value: T);
|
|
45
|
-
protected validateValue(value: T): boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Self-referencing class that extends GenericContainer
|
|
49
|
-
*/
|
|
50
|
-
export declare class SelfReferencingGenericClass extends GenericContainer<SelfReferencingGenericClass> implements ICircularReference<SelfReferencingGenericClass> {
|
|
51
|
-
id: number;
|
|
52
|
-
name: string;
|
|
53
|
-
constructor(id: number, name: string);
|
|
54
|
-
getReference(): SelfReferencingGenericClass | undefined;
|
|
55
|
-
setReference(ref: SelfReferencingGenericClass): void;
|
|
56
|
-
protected validateValue(value: SelfReferencingGenericClass): boolean;
|
|
57
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nested TypeScript classes to test object relationships
|
|
3
|
-
*/
|
|
4
|
-
export declare class Address {
|
|
5
|
-
street: string;
|
|
6
|
-
city: string;
|
|
7
|
-
state: string;
|
|
8
|
-
zipCode: string;
|
|
9
|
-
country: string;
|
|
10
|
-
}
|
|
11
|
-
export declare class Role {
|
|
12
|
-
id: number;
|
|
13
|
-
name: string;
|
|
14
|
-
permissions: string[];
|
|
15
|
-
level: number;
|
|
16
|
-
}
|
|
17
|
-
export declare class Company {
|
|
18
|
-
name: string;
|
|
19
|
-
industry: string;
|
|
20
|
-
foundedYear: number;
|
|
21
|
-
employees: number;
|
|
22
|
-
}
|
|
23
|
-
export declare class EmergencyContact {
|
|
24
|
-
name: string;
|
|
25
|
-
phone: string;
|
|
26
|
-
relationship: string;
|
|
27
|
-
}
|
|
28
|
-
export declare class NestedUser {
|
|
29
|
-
id: number;
|
|
30
|
-
name: string;
|
|
31
|
-
email: string;
|
|
32
|
-
address: Address;
|
|
33
|
-
roles: Role[];
|
|
34
|
-
company: Company;
|
|
35
|
-
alternativeAddresses: Address[];
|
|
36
|
-
emergencyContact?: EmergencyContact;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Deep nesting example
|
|
40
|
-
*/
|
|
41
|
-
export declare class Department {
|
|
42
|
-
id: number;
|
|
43
|
-
name: string;
|
|
44
|
-
budget: number;
|
|
45
|
-
}
|
|
46
|
-
export declare class Team {
|
|
47
|
-
id: number;
|
|
48
|
-
name: string;
|
|
49
|
-
department: Department;
|
|
50
|
-
members: TeamMember[];
|
|
51
|
-
}
|
|
52
|
-
export declare class TeamMember {
|
|
53
|
-
id: number;
|
|
54
|
-
name: string;
|
|
55
|
-
email: string;
|
|
56
|
-
role: string;
|
|
57
|
-
startDate: Date;
|
|
58
|
-
}
|
|
59
|
-
export declare class Subsidiary {
|
|
60
|
-
name: string;
|
|
61
|
-
location: Address;
|
|
62
|
-
established: Date;
|
|
63
|
-
}
|
|
64
|
-
export declare class Organization {
|
|
65
|
-
id: number;
|
|
66
|
-
name: string;
|
|
67
|
-
teams: Team[];
|
|
68
|
-
headquarters: Address;
|
|
69
|
-
subsidiaries: Subsidiary[];
|
|
70
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare class LeafClass {
|
|
2
|
-
name: string;
|
|
3
|
-
}
|
|
4
|
-
export declare class MiddleClass {
|
|
5
|
-
name: string;
|
|
6
|
-
leaf: LeafClass;
|
|
7
|
-
}
|
|
8
|
-
export declare class RootClass {
|
|
9
|
-
id: number;
|
|
10
|
-
middle: MiddleClass;
|
|
11
|
-
leaf: LeafClass;
|
|
12
|
-
}
|
|
13
|
-
export declare class DeepLeaf {
|
|
14
|
-
tag: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class DeepLevel2 {
|
|
17
|
-
leaf: DeepLeaf;
|
|
18
|
-
}
|
|
19
|
-
export declare class DeepLevel1 {
|
|
20
|
-
level2: DeepLevel2;
|
|
21
|
-
}
|
|
22
|
-
export declare class DeepRoot {
|
|
23
|
-
level1: DeepLevel1;
|
|
24
|
-
directLeaf: DeepLeaf;
|
|
25
|
-
}
|
|
26
|
-
export declare class ArrayItem {
|
|
27
|
-
id: number;
|
|
28
|
-
}
|
|
29
|
-
export declare class ArrayRoot {
|
|
30
|
-
items: ArrayItem[];
|
|
31
|
-
single: ArrayItem;
|
|
32
|
-
}
|
|
33
|
-
export declare class SiblingLeaf {
|
|
34
|
-
value: number;
|
|
35
|
-
}
|
|
36
|
-
export declare class SiblingRoot {
|
|
37
|
-
left: SiblingLeaf;
|
|
38
|
-
right: SiblingLeaf;
|
|
39
|
-
}
|
|
40
|
-
export declare class CircularNode {
|
|
41
|
-
name: string;
|
|
42
|
-
child: CircularNode;
|
|
43
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure TypeScript class without any decorators
|
|
3
|
-
* Used to test basic type inference and transformation
|
|
4
|
-
*/
|
|
5
|
-
export declare class PureUser {
|
|
6
|
-
id: number;
|
|
7
|
-
name: string;
|
|
8
|
-
email: string;
|
|
9
|
-
age: number;
|
|
10
|
-
isActive: boolean;
|
|
11
|
-
tags: string[];
|
|
12
|
-
metadata: Record<string, any>;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
phone?: string;
|
|
15
|
-
bio?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Pure TypeScript class with primitive types only
|
|
19
|
-
*/
|
|
20
|
-
export declare class SimplePerson {
|
|
21
|
-
firstName: string;
|
|
22
|
-
lastName: string;
|
|
23
|
-
age: number;
|
|
24
|
-
isEmployed: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Pure TypeScript class with arrays
|
|
28
|
-
*/
|
|
29
|
-
export declare class Product {
|
|
30
|
-
id: number;
|
|
31
|
-
name: string;
|
|
32
|
-
price: number;
|
|
33
|
-
categories: string[];
|
|
34
|
-
scores: number[];
|
|
35
|
-
isAvailable: boolean;
|
|
36
|
-
description?: string;
|
|
37
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Classes for testing schema validation
|
|
3
|
-
*/
|
|
4
|
-
export declare class TypeMappingTest {
|
|
5
|
-
stringProp: string;
|
|
6
|
-
numberProp: number;
|
|
7
|
-
booleanProp: boolean;
|
|
8
|
-
arrayProp: string[];
|
|
9
|
-
objectProp: Record<string, any>;
|
|
10
|
-
dateProp: Date;
|
|
11
|
-
}
|
|
12
|
-
export declare class NestedSchema {
|
|
13
|
-
id: number;
|
|
14
|
-
name: string;
|
|
15
|
-
nested: {
|
|
16
|
-
prop1: string;
|
|
17
|
-
prop2: number;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export declare class CircularA {
|
|
21
|
-
id: number;
|
|
22
|
-
name: string;
|
|
23
|
-
refToB: CircularB;
|
|
24
|
-
}
|
|
25
|
-
export declare class CircularB {
|
|
26
|
-
id: number;
|
|
27
|
-
description: string;
|
|
28
|
-
refToA: CircularA;
|
|
29
|
-
}
|
|
30
|
-
export declare class RequiredFieldsTest {
|
|
31
|
-
required1: string;
|
|
32
|
-
required2: number;
|
|
33
|
-
optional1?: string;
|
|
34
|
-
optional2?: number;
|
|
35
|
-
}
|
package/dist/__test__/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import './testCases/pure-classes.test';
|
|
2
|
-
import './testCases/decorated-classes.test';
|
|
3
|
-
import './testCases/nested-classes.test';
|
|
4
|
-
import './testCases/enum-properties.test';
|
|
5
|
-
import './testCases/collision.test';
|
|
6
|
-
import './testCases/collision-advanced.test';
|
|
7
|
-
import './testCases/generics-and-modifiers.test';
|
|
8
|
-
import './testCases/nested-reuse.test';
|