@twin.org/ts-to-openapi 0.0.1-next.9 → 0.0.1

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.
@@ -0,0 +1,5 @@
1
+ import type { AnySchemaObject } from "ajv/dist/2020.js";
2
+ /**
3
+ * Default schema type.
4
+ */
5
+ export type IJsonSchema = AnySchemaObject;
@@ -1,4 +1,4 @@
1
- import type { JSONSchema7 } from "json-schema";
1
+ import type { IJsonSchema } from "./IJsonSchema";
2
2
  import type { IOpenApiPathMethod } from "./IOpenApiPathMethod";
3
3
  import type { IOpenApiSecurityScheme } from "./IOpenApiSecurityScheme";
4
4
  /**
@@ -46,7 +46,7 @@ export interface IOpenApi {
46
46
  * The components.
47
47
  */
48
48
  components?: {
49
- schemas?: JSONSchema7;
49
+ schemas?: IJsonSchema;
50
50
  securitySchemes?: {
51
51
  [name: string]: IOpenApiSecurityScheme;
52
52
  };
@@ -1,6 +1,7 @@
1
- import type { JSONSchema7Type, JSONSchema7TypeName } from "json-schema";
1
+ import type { IJsonSchema } from "./IJsonSchema";
2
2
  import type { IOpenApiExample } from "./IOpenApiExample";
3
3
  import type { IOpenApiResponse } from "./IOpenApiResponse";
4
+ import type { JsonTypeName } from "./jsonTypeName";
4
5
  /**
5
6
  * The Open API config definition.
6
7
  */
@@ -26,8 +27,8 @@ export interface IOpenApiPathMethod {
26
27
  description?: string;
27
28
  required: boolean;
28
29
  schema: {
29
- type?: JSONSchema7TypeName | JSONSchema7TypeName[];
30
- enum?: JSONSchema7Type[];
30
+ type?: JsonTypeName | JsonTypeName[];
31
+ enum?: IJsonSchema[];
31
32
  $ref?: string;
32
33
  };
33
34
  style?: string;
@@ -0,0 +1,5 @@
1
+ import type { JSONType } from "ajv/dist/2020.js";
2
+ /**
3
+ * Default schema type.
4
+ */
5
+ export type JsonTypeName = JSONType;
package/docs/changelog.md CHANGED
@@ -1,5 +1,199 @@
1
1
  # @twin.org/ts-to-openapi - Changelog
2
2
 
3
- ## v0.0.1-next.9
3
+ ## 0.0.1 (2025-07-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * release to production ([ad24b7e](https://github.com/twinfoundation/tools/commit/ad24b7eb16784165b6c93b5c48788199f0e17526))
9
+
10
+ ## [0.0.1-next.29](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.28...ts-to-openapi-v0.0.1-next.29) (2025-07-02)
11
+
12
+
13
+ ### Features
14
+
15
+ * move package to framework repo ([4490bda](https://github.com/twinfoundation/tools/commit/4490bda472d4dc8ddfe931e2fce81f3411de9ab3))
16
+
17
+ ## [0.0.1-next.28](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.27...ts-to-openapi-v0.0.1-next.28) (2025-06-18)
18
+
19
+
20
+ ### Features
21
+
22
+ * improve schema type name normalisation ([1a18b26](https://github.com/twinfoundation/tools/commit/1a18b267d87e9179bda01b396b256c450ae2889e))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/nameof bumped from 0.0.1-next.27 to 0.0.1-next.28
30
+ * devDependencies
31
+ * @twin.org/merge-locales bumped from 0.0.1-next.27 to 0.0.1-next.28
32
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.27 to 0.0.1-next.28
33
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.27 to 0.0.1-next.28
34
+
35
+ ## [0.0.1-next.27](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.26...ts-to-openapi-v0.0.1-next.27) (2025-06-17)
36
+
37
+
38
+ ### Features
39
+
40
+ * add latest json schema features ([494293f](https://github.com/twinfoundation/tools/commit/494293f4252b9c7d4a20790ec157fc9d8c96c3d2))
41
+
42
+
43
+ ### Dependencies
44
+
45
+ * The following workspace dependencies were updated
46
+ * dependencies
47
+ * @twin.org/nameof bumped from 0.0.1-next.26 to 0.0.1-next.27
48
+ * devDependencies
49
+ * @twin.org/merge-locales bumped from 0.0.1-next.26 to 0.0.1-next.27
50
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.26 to 0.0.1-next.27
51
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.26 to 0.0.1-next.27
52
+
53
+ ## [0.0.1-next.26](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.25...ts-to-openapi-v0.0.1-next.26) (2025-06-11)
54
+
55
+
56
+ ### Features
57
+
58
+ * use most recent JSON schema specs ([4598cbf](https://github.com/twinfoundation/tools/commit/4598cbf29f7b82dba4a9f3b19f81dfe66f5a6060))
59
+
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @twin.org/nameof bumped from 0.0.1-next.25 to 0.0.1-next.26
66
+ * devDependencies
67
+ * @twin.org/merge-locales bumped from 0.0.1-next.25 to 0.0.1-next.26
68
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.25 to 0.0.1-next.26
69
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.25 to 0.0.1-next.26
70
+
71
+ ## [0.0.1-next.25](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.24...ts-to-openapi-v0.0.1-next.25) (2025-06-10)
72
+
73
+
74
+ ### Features
75
+
76
+ * add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
77
+
78
+
79
+ ### Dependencies
80
+
81
+ * The following workspace dependencies were updated
82
+ * dependencies
83
+ * @twin.org/nameof bumped from 0.0.1-next.24 to 0.0.1-next.25
84
+ * devDependencies
85
+ * @twin.org/merge-locales bumped from 0.0.1-next.24 to 0.0.1-next.25
86
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.24 to 0.0.1-next.25
87
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.24 to 0.0.1-next.25
88
+
89
+ ## [0.0.1-next.24](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.23...ts-to-openapi-v0.0.1-next.24) (2025-06-05)
90
+
91
+
92
+ ### Features
93
+
94
+ * strip Omit types ([3a079f9](https://github.com/twinfoundation/tools/commit/3a079f9abe8127c5b44a2b9382babf2f19629d08))
95
+
96
+
97
+ ### Dependencies
98
+
99
+ * The following workspace dependencies were updated
100
+ * dependencies
101
+ * @twin.org/nameof bumped from 0.0.1-next.23 to 0.0.1-next.24
102
+ * devDependencies
103
+ * @twin.org/merge-locales bumped from 0.0.1-next.23 to 0.0.1-next.24
104
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.23 to 0.0.1-next.24
105
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.23 to 0.0.1-next.24
106
+
107
+ ## [0.0.1-next.23](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.22...ts-to-openapi-v0.0.1-next.23) (2025-06-03)
108
+
109
+
110
+ ### Bug Fixes
111
+
112
+ * fix locale resource name ([53ad5b5](https://github.com/twinfoundation/tools/commit/53ad5b56f19a5082f16a4f1e4a761e114dce8250))
113
+
114
+
115
+ ### Dependencies
116
+
117
+ * The following workspace dependencies were updated
118
+ * dependencies
119
+ * @twin.org/nameof bumped from 0.0.1-next.22 to 0.0.1-next.23
120
+ * devDependencies
121
+ * @twin.org/merge-locales bumped from 0.0.1-next.22 to 0.0.1-next.23
122
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.22 to 0.0.1-next.23
123
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.22 to 0.0.1-next.23
124
+
125
+ ## [0.0.1-next.22](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.21...ts-to-openapi-v0.0.1-next.22) (2025-06-03)
126
+
127
+
128
+ ### Features
129
+
130
+ * generate schemas as individual entities ([9f372ab](https://github.com/twinfoundation/tools/commit/9f372abdfc27aba93b303c7b214991919c0c18c3))
131
+
132
+
133
+ ### Dependencies
134
+
135
+ * The following workspace dependencies were updated
136
+ * dependencies
137
+ * @twin.org/nameof bumped from 0.0.1-next.21 to 0.0.1-next.22
138
+ * devDependencies
139
+ * @twin.org/merge-locales bumped from 0.0.1-next.21 to 0.0.1-next.22
140
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.21 to 0.0.1-next.22
141
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.21 to 0.0.1-next.22
142
+
143
+ ## [0.0.1-next.21](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.20...ts-to-openapi-v0.0.1-next.21) (2025-04-17)
144
+
145
+
146
+ ### Features
147
+
148
+ * use shared store mechanism ([#31](https://github.com/twinfoundation/tools/issues/31)) ([d9fe68b](https://github.com/twinfoundation/tools/commit/d9fe68b903d1268c7cb3c64772df5cb78fd63667))
149
+
150
+
151
+ ### Dependencies
152
+
153
+ * The following workspace dependencies were updated
154
+ * dependencies
155
+ * @twin.org/nameof bumped from 0.0.1-next.20 to 0.0.1-next.21
156
+ * devDependencies
157
+ * @twin.org/merge-locales bumped from 0.0.1-next.20 to 0.0.1-next.21
158
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.20 to 0.0.1-next.21
159
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.20 to 0.0.1-next.21
160
+
161
+ ## [0.0.1-next.20](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.19...ts-to-openapi-v0.0.1-next.20) (2025-03-28)
162
+
163
+
164
+ ### Miscellaneous Chores
165
+
166
+ * **ts-to-openapi:** Synchronize repo versions
167
+
168
+
169
+ ### Dependencies
170
+
171
+ * The following workspace dependencies were updated
172
+ * dependencies
173
+ * @twin.org/nameof bumped from 0.0.1-next.19 to 0.0.1-next.20
174
+ * devDependencies
175
+ * @twin.org/merge-locales bumped from 0.0.1-next.19 to 0.0.1-next.20
176
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.19 to 0.0.1-next.20
177
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.19 to 0.0.1-next.20
178
+
179
+ ## [0.0.1-next.19](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.1-next.18...ts-to-openapi-v0.0.1-next.19) (2025-03-26)
180
+
181
+
182
+ ### Miscellaneous Chores
183
+
184
+ * **ts-to-openapi:** Synchronize repo versions
185
+
186
+
187
+ ### Dependencies
188
+
189
+ * The following workspace dependencies were updated
190
+ * dependencies
191
+ * @twin.org/nameof bumped from 0.0.1-next.18 to 0.0.1-next.19
192
+ * devDependencies
193
+ * @twin.org/merge-locales bumped from 0.0.1-next.18 to 0.0.1-next.19
194
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.18 to 0.0.1-next.19
195
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.18 to 0.0.1-next.19
196
+
197
+ ## v0.0.1-next.18
4
198
 
5
199
  - Initial Release
@@ -8,13 +8,13 @@ The main entry point for the CLI.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new CLI()
11
+ ### Constructor
12
12
 
13
- > **new CLI**(): [`CLI`](CLI.md)
13
+ > **new CLI**(): `CLI`
14
14
 
15
15
  #### Returns
16
16
 
17
- [`CLI`](CLI.md)
17
+ `CLI`
18
18
 
19
19
  #### Inherited from
20
20
 
@@ -24,25 +24,31 @@ The main entry point for the CLI.
24
24
 
25
25
  ### run()
26
26
 
27
- > **run**(`argv`, `localesDirectory`?, `options`?): `Promise`\<`number`\>
27
+ > **run**(`argv`, `localesDirectory?`, `options?`): `Promise`\<`number`\>
28
28
 
29
29
  Run the app.
30
30
 
31
31
  #### Parameters
32
32
 
33
- **argv**: `string`[]
33
+ ##### argv
34
+
35
+ `string`[]
34
36
 
35
37
  The process arguments.
36
38
 
37
- **localesDirectory?**: `string`
39
+ ##### localesDirectory?
40
+
41
+ `string`
38
42
 
39
43
  The directory for the locales, default to relative to the script.
40
44
 
41
- **options?**
45
+ ##### options?
42
46
 
43
47
  Additional options.
44
48
 
45
- **options.overrideOutputWidth?**: `number`
49
+ ###### overrideOutputWidth?
50
+
51
+ `number`
46
52
 
47
53
  Override the output width.
48
54
 
@@ -62,7 +68,9 @@ Configure any options or actions at the root program level.
62
68
 
63
69
  #### Parameters
64
70
 
65
- **program**: `Command`
71
+ ##### program
72
+
73
+ `Command`
66
74
 
67
75
  The root program command.
68
76
 
@@ -6,15 +6,21 @@ Action the root command.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **configFile**: `string`
9
+ ### configFile
10
+
11
+ `string`
10
12
 
11
13
  The optional configuration file.
12
14
 
13
- **outputFile**: `string`
15
+ ### outputFile
16
+
17
+ `string`
14
18
 
15
19
  The output file for the generation OpenApi spec.
16
20
 
17
- **opts**: `unknown`
21
+ ### opts
22
+
23
+ `unknown`
18
24
 
19
25
  The options for the command.
20
26
 
@@ -6,7 +6,9 @@ Build the root command to be consumed by the CLI.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **program**: `Command`
9
+ ### program
10
+
11
+ `Command`
10
12
 
11
13
  The command to build on.
12
14
 
@@ -6,15 +6,21 @@ Convert the TypeScript definitions to OpenAPI spec.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **config**: [`ITsToOpenApiConfig`](../interfaces/ITsToOpenApiConfig.md)
9
+ ### config
10
+
11
+ [`ITsToOpenApiConfig`](../interfaces/ITsToOpenApiConfig.md)
10
12
 
11
13
  The configuration for the app.
12
14
 
13
- **outputFile**: `string`
15
+ ### outputFile
16
+
17
+ `string`
14
18
 
15
19
  The location of the file to output the OpenAPI spec.
16
20
 
17
- **workingDirectory**: `string`
21
+ ### workingDirectory
22
+
23
+ `string`
18
24
 
19
25
  The folder the app was run from.
20
26
 
@@ -66,6 +66,30 @@ The authentication methods.
66
66
 
67
67
  The packages containing routes.
68
68
 
69
+ #### package?
70
+
71
+ > `optional` **package**: `string`
72
+
73
+ The package containing the routes.
74
+
75
+ #### version?
76
+
77
+ > `optional` **version**: `string`
78
+
79
+ The version of the package to use, defaults to latest.
80
+
81
+ #### packageRoot?
82
+
83
+ > `optional` **packageRoot**: `string`
84
+
85
+ To point to a local instance of a package use this property instead of package/version.
86
+
87
+ #### entryPoints?
88
+
89
+ > `optional` **entryPoints**: [`ITsToOpenApiConfigEntryPoint`](ITsToOpenApiConfigEntryPoint.md)[]
90
+
91
+ The rest entry points to include, defaults to all exported entry points.
92
+
69
93
  ***
70
94
 
71
95
  ### externalReferences?
@@ -76,4 +100,4 @@ External type references
76
100
 
77
101
  #### Index Signature
78
102
 
79
- \[`id`: `string`\]: `string`
103
+ \[`id`: `string`\]: `string`
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@twin.org/ts-to-openapi",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.1",
4
4
  "description": "Tool to convert TypeScript REST route definitions to OpenAPI Specifications",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/tools.git",
8
- "directory": "packages/ts-to-openapi"
8
+ "directory": "apps/ts-to-openapi"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
11
11
  "license": "Apache-2.0",
@@ -14,24 +14,24 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-models": "next",
18
- "@twin.org/cli-core": "next",
19
- "@twin.org/core": "next",
20
- "@twin.org/nameof": "0.0.1-next.9",
21
- "@twin.org/web": "next",
22
- "commander": "12.1.0",
23
- "glob": "11.0.0",
24
- "jsonschema": "1.4.1",
25
- "ts-json-schema-generator": "2.4.0-next.1"
17
+ "@twin.org/api-models": "^0.0.1-next.1",
18
+ "@twin.org/cli-core": "^0.0.1",
19
+ "@twin.org/core": "^0.0.1",
20
+ "@twin.org/nameof": "^0.0.1",
21
+ "@twin.org/web": "^0.0.1",
22
+ "ajv": "8.17.1",
23
+ "commander": "14.0.0",
24
+ "glob": "11.0.2",
25
+ "ts-json-schema-generator": "2.4.0"
26
26
  },
27
27
  "main": "./dist/cjs/index.cjs",
28
28
  "module": "./dist/esm/index.mjs",
29
29
  "types": "./dist/types/index.d.ts",
30
30
  "exports": {
31
31
  ".": {
32
+ "types": "./dist/types/index.d.ts",
32
33
  "require": "./dist/cjs/index.cjs",
33
- "import": "./dist/esm/index.mjs",
34
- "types": "./dist/types/index.d.ts"
34
+ "import": "./dist/esm/index.mjs"
35
35
  }
36
36
  },
37
37
  "files": [