ts-class-to-openapi 1.0.5 → 1.0.6
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/README.md +368 -882
- package/dist/__test__/entities/additional-test-classes.d.ts +12 -0
- package/dist/__test__/entities/decorated-classes.d.ts +54 -0
- package/dist/__test__/entities/nested-classes.d.ts +70 -0
- package/dist/__test__/entities/pure-classes.d.ts +37 -0
- package/dist/__test__/entities/schema-validation-classes.d.ts +35 -0
- package/dist/__test__/index.d.ts +3 -9
- package/dist/__test__/test.d.ts +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +475 -1324
- package/dist/index.js +474 -1324
- package/dist/run.d.ts +1 -1
- package/dist/run.js +1062 -1350
- package/dist/transformer.d.ts +1 -575
- package/dist/transformer.fixtures.d.ts +21 -0
- package/dist/types.d.ts +38 -3
- package/package.json +16 -15
- package/dist/__test__/entities/address.entity.d.ts +0 -5
- package/dist/__test__/entities/array.entity.d.ts +0 -7
- package/dist/__test__/entities/broken.entity.d.ts +0 -7
- package/dist/__test__/entities/circular.entity.d.ts +0 -59
- package/dist/__test__/entities/complete.entity.d.ts +0 -16
- package/dist/__test__/entities/complex-generics.entity.d.ts +0 -33
- package/dist/__test__/entities/comprehensive-enum.entity.d.ts +0 -23
- package/dist/__test__/entities/enum.entity.d.ts +0 -29
- package/dist/__test__/entities/generic.entity.d.ts +0 -11
- package/dist/__test__/entities/optional-properties.entity.d.ts +0 -11
- package/dist/__test__/entities/plain.entity.d.ts +0 -19
- package/dist/__test__/entities/simple.entity.d.ts +0 -5
- package/dist/__test__/entities/upload.entity.d.ts +0 -8
- package/dist/__test__/entities/user-role-generic.entity.d.ts +0 -13
- package/dist/__test__/plain.test.d.ts +0 -1
- package/dist/__test__/ref-pattern.test.d.ts +0 -1
- package/dist/__test__/singleton-behavior.test.d.ts +0 -1
- package/dist/__test__/test-entities/duplicate-name.entity.d.ts +0 -5
- package/dist/__test__/test-entities/generic.entity.d.ts +0 -11
- /package/dist/__test__/{circular-reference.test.d.ts → testCases/debug.test.d.ts} +0 -0
- /package/dist/__test__/{enum.test.d.ts → testCases/decorated-classes.test.d.ts} +0 -0
- /package/dist/__test__/{generic-types.test.d.ts → testCases/edge-cases.test.d.ts} +0 -0
- /package/dist/__test__/{integration.test.d.ts → testCases/nested-classes.test.d.ts} +0 -0
- /package/dist/__test__/{main.test.d.ts → testCases/pure-classes.test.d.ts} +0 -0
- /package/dist/__test__/{optional-properties.test.d.ts → testCases/schema-validation.test.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-class-to-openapi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Transform TypeScript classes into OpenAPI 3.1.0 schema objects, which support class-validator decorators",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
"README.md",
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
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
21
|
"repository": {
|
|
34
22
|
"type": "git",
|
|
35
23
|
"url": "git+https://github.com/julioolivares/ts-class-to-openapi.git"
|
|
@@ -82,7 +70,20 @@
|
|
|
82
70
|
"glob": "10.3.10",
|
|
83
71
|
"prettier": "3.6.2",
|
|
84
72
|
"rollup": "4.46.2",
|
|
73
|
+
"socket.io": "4.8.1",
|
|
85
74
|
"tslib": "2.8.1"
|
|
86
75
|
},
|
|
87
|
-
"package": "./package-dist.json"
|
|
88
|
-
|
|
76
|
+
"package": "./package-dist.json",
|
|
77
|
+
"scripts": {
|
|
78
|
+
"test": "npm run build:test && node --test dist/test.js",
|
|
79
|
+
"test:watch": "npm run build:test && node --test --watch dist/**/*.test.js",
|
|
80
|
+
"test:coverage": "npm run build:test && node --test --experimental-test-coverage dist/**/*.test.js",
|
|
81
|
+
"build": "rm -rf dist && rollup -c",
|
|
82
|
+
"build:test": "rm -rf dist && BUILD_TARGET=test rollup -c",
|
|
83
|
+
"build:watch": "rm -rf dist && rollup -c -w",
|
|
84
|
+
"dev": "node --trace-deprecation --watch dist/run.js",
|
|
85
|
+
"format": "prettier --write .",
|
|
86
|
+
"format:check": "prettier --check .",
|
|
87
|
+
"prepublish": "pnpm run build"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example entity demonstrating circular reference issue
|
|
3
|
-
* User -> Role -> User (circular)
|
|
4
|
-
*/
|
|
5
|
-
export declare class CircularUser {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
role: CircularRole;
|
|
9
|
-
organization: CircularOrganization;
|
|
10
|
-
organizations: CircularOrganization[];
|
|
11
|
-
}
|
|
12
|
-
export declare class CircularRole {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
assignedBy: CircularUser;
|
|
16
|
-
organization: CircularOrganization;
|
|
17
|
-
usersWithRole: CircularUser[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Example entity demonstrating complex circular references
|
|
21
|
-
* Organization -> User, Role, Organization (multiple circular references)
|
|
22
|
-
*/
|
|
23
|
-
export declare class CircularOrganization {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
owner: CircularUser;
|
|
27
|
-
defaultRole: CircularRole;
|
|
28
|
-
members: CircularUser[];
|
|
29
|
-
availableRoles: CircularRole[];
|
|
30
|
-
parentOrganization?: CircularOrganization;
|
|
31
|
-
childOrganizations: CircularOrganization[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Example demonstrating deep circular reference chain
|
|
35
|
-
* A -> B -> C -> D -> A (complex chain)
|
|
36
|
-
*/
|
|
37
|
-
export declare class DeepCircularA {
|
|
38
|
-
id: string;
|
|
39
|
-
reference: DeepCircularB;
|
|
40
|
-
}
|
|
41
|
-
export declare class DeepCircularB {
|
|
42
|
-
id: string;
|
|
43
|
-
reference: DeepCircularC;
|
|
44
|
-
}
|
|
45
|
-
export declare class DeepCircularC {
|
|
46
|
-
id: string;
|
|
47
|
-
reference: DeepCircularD;
|
|
48
|
-
}
|
|
49
|
-
export declare class DeepCircularD {
|
|
50
|
-
id: string;
|
|
51
|
-
reference: DeepCircularA;
|
|
52
|
-
allReferences: {
|
|
53
|
-
a: DeepCircularA;
|
|
54
|
-
b: DeepCircularB;
|
|
55
|
-
c: DeepCircularC;
|
|
56
|
-
selfRef: DeepCircularD;
|
|
57
|
-
};
|
|
58
|
-
arrayReferences: (DeepCircularA | DeepCircularB | DeepCircularC | DeepCircularD)[];
|
|
59
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Address } from './address.entity.js';
|
|
2
|
-
export declare class CompleteEntity {
|
|
3
|
-
id: number;
|
|
4
|
-
name: string;
|
|
5
|
-
email: string;
|
|
6
|
-
active: boolean;
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
price: number;
|
|
9
|
-
code: string;
|
|
10
|
-
shortCode: string;
|
|
11
|
-
tags: string[];
|
|
12
|
-
emails: string[];
|
|
13
|
-
numbers: number[];
|
|
14
|
-
address: Address;
|
|
15
|
-
profile: Partial<CompleteEntity>;
|
|
16
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type ApiResponse<T> = {
|
|
2
|
-
data: T;
|
|
3
|
-
message: string;
|
|
4
|
-
success: boolean;
|
|
5
|
-
};
|
|
6
|
-
export type PaginatedResponse<T> = {
|
|
7
|
-
items: T[];
|
|
8
|
-
total: number;
|
|
9
|
-
page: number;
|
|
10
|
-
};
|
|
11
|
-
export declare class Product {
|
|
12
|
-
id: number;
|
|
13
|
-
name: string;
|
|
14
|
-
price: number;
|
|
15
|
-
}
|
|
16
|
-
export declare class UserEntity {
|
|
17
|
-
id: number;
|
|
18
|
-
username: string;
|
|
19
|
-
email: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class ProductResponseDto {
|
|
22
|
-
response: ApiResponse<Product>;
|
|
23
|
-
}
|
|
24
|
-
export declare class UserListDto {
|
|
25
|
-
users: PaginatedResponse<UserEntity>;
|
|
26
|
-
}
|
|
27
|
-
export type KeyValuePair<K, V> = {
|
|
28
|
-
key: K;
|
|
29
|
-
value: V;
|
|
30
|
-
};
|
|
31
|
-
export declare class ConfigDto {
|
|
32
|
-
setting: KeyValuePair<string, number>;
|
|
33
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare enum Color {
|
|
2
|
-
RED = "red",
|
|
3
|
-
GREEN = "green",
|
|
4
|
-
BLUE = "blue"
|
|
5
|
-
}
|
|
6
|
-
declare enum Size {
|
|
7
|
-
SMALL = 0,
|
|
8
|
-
MEDIUM = 1,
|
|
9
|
-
LARGE = 2
|
|
10
|
-
}
|
|
11
|
-
declare enum HttpStatus {
|
|
12
|
-
OK = 200,
|
|
13
|
-
NOT_FOUND = 404,
|
|
14
|
-
ERROR = "server_error"
|
|
15
|
-
}
|
|
16
|
-
export declare class ComprehensiveEnumEntity {
|
|
17
|
-
primaryColor: Color;
|
|
18
|
-
size?: Size;
|
|
19
|
-
status?: HttpStatus;
|
|
20
|
-
availableColors?: Color[];
|
|
21
|
-
supportedSizes: Size[];
|
|
22
|
-
}
|
|
23
|
-
export { Color, Size, HttpStatus };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare enum UserRole {
|
|
2
|
-
ADMIN = "admin",
|
|
3
|
-
USER = "user",
|
|
4
|
-
MODERATOR = "moderator"
|
|
5
|
-
}
|
|
6
|
-
declare enum Priority {
|
|
7
|
-
LOW = 1,
|
|
8
|
-
MEDIUM = 2,
|
|
9
|
-
HIGH = 3
|
|
10
|
-
}
|
|
11
|
-
declare const Status: {
|
|
12
|
-
readonly ACTIVE: "active";
|
|
13
|
-
readonly INACTIVE: "inactive";
|
|
14
|
-
readonly PENDING: "pending";
|
|
15
|
-
};
|
|
16
|
-
declare enum BooleanEnum {
|
|
17
|
-
TRUE = "true",
|
|
18
|
-
FALSE = "false"
|
|
19
|
-
}
|
|
20
|
-
export declare class EnumTestEntity {
|
|
21
|
-
role: UserRole;
|
|
22
|
-
priority?: Priority;
|
|
23
|
-
status?: keyof typeof Status;
|
|
24
|
-
flag?: BooleanEnum;
|
|
25
|
-
roles?: UserRole[];
|
|
26
|
-
priorities?: Priority[];
|
|
27
|
-
optionalRole?: UserRole;
|
|
28
|
-
}
|
|
29
|
-
export { UserRole, Priority, Status, BooleanEnum };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare class PlainUser {
|
|
2
|
-
id: number;
|
|
3
|
-
name: string;
|
|
4
|
-
email: string;
|
|
5
|
-
age: number;
|
|
6
|
-
isActive: boolean;
|
|
7
|
-
tags: string[];
|
|
8
|
-
createdAt: Date;
|
|
9
|
-
profile: UserProfile;
|
|
10
|
-
}
|
|
11
|
-
export declare class UserProfile {
|
|
12
|
-
bio: string;
|
|
13
|
-
avatar: string;
|
|
14
|
-
socialMedia: SocialMedia;
|
|
15
|
-
}
|
|
16
|
-
export declare class SocialMedia {
|
|
17
|
-
twitter: string;
|
|
18
|
-
github: string;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/__test__/{optional-properties.test.d.ts → testCases/schema-validation.test.d.ts}
RENAMED
|
File without changes
|