@twin.org/ts-to-openapi 0.0.3-next.13 → 0.0.3-next.15
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 +2 -2
- package/dist/es/cli.js +1 -1
- package/dist/es/cli.js.map +1 -1
- package/docs/changelog.md +28 -0
- package/docs/examples.md +21 -47
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# TWIN TypeScript to OpenApi
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This app generates OpenAPI specifications from REST route definitions so API contracts can be shared, validated, and published with a consistent structure.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```shell
|
|
8
|
-
npm install @twin.org/ts-to-openapi
|
|
8
|
+
npm install -D @twin.org/ts-to-openapi
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Examples
|
package/dist/es/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ export class CLI extends CLIBase {
|
|
|
20
20
|
return this.execute({
|
|
21
21
|
title: "TWIN TypeScript To OpenAPI",
|
|
22
22
|
appName: "ts-to-openapi",
|
|
23
|
-
version: "0.0.3-next.
|
|
23
|
+
version: "0.0.3-next.15", // x-release-please-version
|
|
24
24
|
icon: "⚙️ ",
|
|
25
25
|
supportsEnvFiles: false,
|
|
26
26
|
overrideOutputWidth: options?.overrideOutputWidth
|
package/dist/es/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAA0C;QAE1C,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,4BAA4B;YACnC,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,eAAe,EAAE,2BAA2B;YACrD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandTsToOpenApi } from \"./commands/tsToOpenApi.js\";\n\n/**\n * The main entry point for the CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: { overrideOutputWidth?: number }\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN TypeScript To OpenAPI\",\n\t\t\t\tappName: \"ts-to-openapi\",\n\t\t\t\tversion: \"0.0.3-next.
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAA0C;QAE1C,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,4BAA4B;YACnC,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,eAAe,EAAE,2BAA2B;YACrD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandTsToOpenApi } from \"./commands/tsToOpenApi.js\";\n\n/**\n * The main entry point for the CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: { overrideOutputWidth?: number }\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN TypeScript To OpenAPI\",\n\t\t\t\tappName: \"ts-to-openapi\",\n\t\t\t\tversion: \"0.0.3-next.15\", // x-release-please-version\n\t\t\t\ticon: \"⚙️ \",\n\t\t\t\tsupportsEnvFiles: false,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Configure any options or actions at the root program level.\n\t * @param program The root program command.\n\t */\n\tprotected configureRoot(program: Command): void {\n\t\tbuildCommandTsToOpenApi(program);\n\t}\n}\n"]}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @twin.org/ts-to-openapi - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.3-next.14...ts-to-openapi-v0.0.3-next.15) (2026-03-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use jsdoc tags for json-ld markup ([1ea872e](https://github.com/twinfoundation/tools/commit/1ea872e07a1cc0e94178158a57383d64008e02e3))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/tools-core bumped from 0.0.3-next.14 to 0.0.3-next.15
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.14](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.3-next.13...ts-to-openapi-v0.0.3-next.14) (2026-03-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **ts-to-openapi:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/tools-core bumped from 0.0.3-next.13 to 0.0.3-next.14
|
|
30
|
+
|
|
3
31
|
## [0.0.3-next.13](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.3-next.12...ts-to-openapi-v0.0.3-next.13) (2026-03-05)
|
|
4
32
|
|
|
5
33
|
|
package/docs/examples.md
CHANGED
|
@@ -1,64 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TypeScript to OpenAPI CLI Usage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use this CLI to generate an OpenAPI document from TypeScript REST route metadata and schema definitions.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Running
|
|
6
|
+
|
|
7
|
+
To install and run the CLI locally use the following commands:
|
|
6
8
|
|
|
7
9
|
```shell
|
|
8
|
-
npm install @twin.org/ts-to-openapi
|
|
10
|
+
npm install @twin.org/ts-to-openapi -g
|
|
11
|
+
ts-to-openapi
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
or run directly using NPX:
|
|
12
15
|
|
|
13
16
|
```shell
|
|
14
|
-
ts-to-openapi
|
|
17
|
+
npx "@twin.org/ts-to-openapi"
|
|
15
18
|
```
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
## Help
|
|
18
21
|
|
|
19
22
|
```shell
|
|
20
|
-
TypeScript
|
|
21
|
-
=====================
|
|
23
|
+
⚙️ TWIN TypeScript To OpenAPI v0.0.3-next.12
|
|
22
24
|
|
|
23
|
-
Usage:
|
|
24
|
-
ts-to-openapi <config-json> <output-api-json>
|
|
25
|
-
Error: You must specify the config json
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
As you can see you must provide both a configuration file, and an output file.
|
|
25
|
+
Usage: ts-to-openapi
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
Arguments:
|
|
28
|
+
config Path to the JSON configuration file.
|
|
29
|
+
output-file The JSON file to write the OpenAPI spec.
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"description": "REST API for TWIN - Test Endpoints.",
|
|
37
|
-
"licenseName": "Apache 2.0 License",
|
|
38
|
-
"licenseUrl": "https://opensource.org/licenses/Apache-2.0",
|
|
39
|
-
"servers": ["https://localhost"],
|
|
40
|
-
"authMethods": ["jwtBearer"],
|
|
41
|
-
"restRoutes": [
|
|
42
|
-
{
|
|
43
|
-
"package": "@twin.org/logging-service",
|
|
44
|
-
"version": "next"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"package": "@twin.org/identity-service",
|
|
48
|
-
"version": "next"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
31
|
+
Options:
|
|
32
|
+
-V, --version output the version number
|
|
33
|
+
--lang <lang> The language to display the output in. (default: "en")
|
|
34
|
+
-h, --help display help for command
|
|
52
35
|
```
|
|
53
36
|
|
|
54
|
-
|
|
37
|
+
## Example
|
|
55
38
|
|
|
56
39
|
```shell
|
|
57
|
-
ts-to-openapi config.json
|
|
40
|
+
ts-to-openapi ./config/openapi.json ./dist/openapi.json
|
|
58
41
|
```
|
|
59
42
|
|
|
60
|
-
When running this command you should see the following output:
|
|
61
|
-
|
|
62
43
|
```shell
|
|
63
44
|
TypeScript to OpenAPI
|
|
64
45
|
=====================
|
|
@@ -69,13 +50,6 @@ Loading Config JSON: config.json
|
|
|
69
50
|
Creating security schemas
|
|
70
51
|
Loading Modules: @twin.org/logging-service@next @twin.org/identity-service@next
|
|
71
52
|
|
|
72
|
-
added 43 packages, and audited 44 packages in 2s
|
|
73
|
-
|
|
74
|
-
1 package is looking for funding
|
|
75
|
-
run `npm fund` for details
|
|
76
|
-
|
|
77
|
-
found 0 vulnerabilities
|
|
78
|
-
|
|
79
53
|
Reading Package JSON: @twin.org/logging-service
|
|
80
54
|
Importing Module: @twin.org/logging-service
|
|
81
55
|
Reading Package JSON: @twin.org/identity-service
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/ts-to-openapi",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.15",
|
|
4
|
+
"description": "Generate OpenAPI specifications from REST route definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/tools.git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@twin.org/cli-core": "next",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/nameof": "next",
|
|
20
|
-
"@twin.org/tools-core": "0.0.3-next.
|
|
20
|
+
"@twin.org/tools-core": "0.0.3-next.15",
|
|
21
21
|
"@twin.org/web": "next",
|
|
22
22
|
"commander": "14.0.3",
|
|
23
23
|
"glob": "13.0.6",
|