@twin.org/ts-to-openapi 0.0.2-next.1 → 0.0.2-next.10

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.
@@ -32,7 +32,7 @@ const HTTP_STATUS_CODE_MAP = {
32
32
  responseType: "IBadRequestResponse",
33
33
  example: {
34
34
  name: "GeneralError",
35
- message: "component.error",
35
+ message: "errorMessage",
36
36
  properties: {
37
37
  foo: "bar"
38
38
  }
@@ -43,7 +43,7 @@ const HTTP_STATUS_CODE_MAP = {
43
43
  responseType: "IUnauthorizedResponse",
44
44
  example: {
45
45
  name: "UnauthorizedError",
46
- message: "component.error"
46
+ message: "errorMessage"
47
47
  }
48
48
  },
49
49
  forbidden: {
@@ -51,7 +51,7 @@ const HTTP_STATUS_CODE_MAP = {
51
51
  responseType: "IForbiddenResponse",
52
52
  example: {
53
53
  name: "NotImplementedError",
54
- message: "component.error",
54
+ message: "errorMessage",
55
55
  properties: {
56
56
  method: "aMethod"
57
57
  }
@@ -62,7 +62,7 @@ const HTTP_STATUS_CODE_MAP = {
62
62
  responseType: "INotFoundResponse",
63
63
  example: {
64
64
  name: "NotFoundError",
65
- message: "component.error",
65
+ message: "errorMessage",
66
66
  properties: {
67
67
  notFoundId: "1"
68
68
  }
@@ -73,7 +73,7 @@ const HTTP_STATUS_CODE_MAP = {
73
73
  responseType: "IConflictResponse",
74
74
  example: {
75
75
  name: "ConflictError",
76
- message: "component.error",
76
+ message: "errorMessage",
77
77
  properties: {
78
78
  conflicts: ["1"]
79
79
  }
@@ -84,7 +84,7 @@ const HTTP_STATUS_CODE_MAP = {
84
84
  responseType: "IInternalServerErrorResponse",
85
85
  example: {
86
86
  name: "InternalServerError",
87
- message: "component.error"
87
+ message: "errorMessage"
88
88
  }
89
89
  },
90
90
  unprocessableEntity: {
@@ -92,7 +92,7 @@ const HTTP_STATUS_CODE_MAP = {
92
92
  responseType: "IUnprocessableEntityResponse",
93
93
  example: {
94
94
  name: "UnprocessableError",
95
- message: "component.error"
95
+ message: "errorMessage"
96
96
  }
97
97
  }
98
98
  };
@@ -196,7 +196,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
196
196
  compilerOptions: {}
197
197
  }, undefined, "\t"));
198
198
  const openApi = {
199
- openapi: "3.1.0",
199
+ openapi: toolsCore.OpenApiHelper.API_VERSION,
200
200
  info: {
201
201
  title: config.title,
202
202
  description: config.description,
@@ -241,7 +241,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
241
241
  }
242
242
  cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.ts-to-openapi.progress.generatingSchemas"));
243
243
  const autoExpandTypes = config.autoExpandTypes ?? [];
244
- const defaultExpandTypes = ["ObjectOrArray<.*>"];
244
+ const defaultExpandTypes = ["/ObjectOrArray<.*>/"];
245
245
  for (const defaultType of defaultExpandTypes) {
246
246
  if (!autoExpandTypes.includes(defaultType)) {
247
247
  autoExpandTypes.push(defaultType);
@@ -438,12 +438,13 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
438
438
  if (requestObject?.properties) {
439
439
  // If there are any properties other than body, query, pathParams and headers
440
440
  // we should throw an error as we don't know what to do with them
441
- const otherKeys = Object.keys(requestObject.properties).filter(k => !["body", "query", "pathParams", "headers"].includes(k));
441
+ const otherKeys = Object.keys(requestObject.properties).filter(k => !["body", "query", "pathParams", "headers", "authentication"].includes(k));
442
442
  if (otherKeys.length > 0) {
443
443
  throw new core.GeneralError("commands", "commands.ts-to-openapi.unsupportedProperties", {
444
444
  keys: otherKeys.join(", ")
445
445
  });
446
446
  }
447
+ delete requestObject.properties.authentication;
447
448
  // If there is a path params object convert these to params
448
449
  if (core.Is.object(requestObject.properties.pathParams)) {
449
450
  for (const pathParam of pathQueryHeaderParams) {
@@ -600,7 +601,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
600
601
  }
601
602
  }
602
603
  }
603
- await finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, config.externalReferences, outputFile);
604
+ await finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, config.externalReferences, autoExpandTypes, outputFile);
604
605
  }
605
606
  /**
606
607
  * Finalise the schemas and output the spec.
@@ -609,9 +610,10 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
609
610
  * @param openApi The OpenAPI spec.
610
611
  * @param securitySchemes The security schemes.
611
612
  * @param externalReferences The external references.
613
+ * @param autoExpandTypes The auto expand types.
612
614
  * @param outputFile The output file.
613
615
  */
614
- async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, externalReferences, outputFile) {
616
+ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, externalReferences, autoExpandTypes, outputFile) {
615
617
  cliCore.CLIDisplay.break();
616
618
  cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.ts-to-openapi.progress.finalisingSchemas"));
617
619
  // Remove the response codes that we haven't used
@@ -652,6 +654,15 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
652
654
  }
653
655
  }
654
656
  }
657
+ // We can remove any auto expand types from the final schema as they
658
+ // will have been expanded inline so no need to keep them
659
+ for (const autoExpandType of autoExpandTypes) {
660
+ const regExp = toolsCore.JsonSchemaHelper.stringToRegEx(autoExpandType);
661
+ if (regExp.test(schema)) {
662
+ skipSchema = true;
663
+ break;
664
+ }
665
+ }
655
666
  if (!skipSchema) {
656
667
  // If the final schema has no properties and is just a ref to another object type
657
668
  // then replace the references with that of the referenced type
@@ -665,7 +676,6 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
665
676
  if (/I[A-Z]/.test(finalName)) {
666
677
  finalName = finalName.slice(1);
667
678
  }
668
- finalName = finalName.replace("<", "_").replace(">", "_");
669
679
  if (finalName.endsWith("[]")) {
670
680
  finalName = `ListOf${finalName.slice(0, -2)}`;
671
681
  }
@@ -1053,7 +1063,7 @@ class CLI extends cliCore.CLIBase {
1053
1063
  return this.execute({
1054
1064
  title: "TWIN TypeScript To OpenAPI",
1055
1065
  appName: "ts-to-openapi",
1056
- version: "0.0.2-next.1", // x-release-please-version
1066
+ version: "0.0.2-next.10", // x-release-please-version
1057
1067
  icon: "⚙️ ",
1058
1068
  supportsEnvFiles: false,
1059
1069
  overrideOutputWidth: options?.overrideOutputWidth
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url';
3
3
  import { CLIDisplay, CLIUtils, CLIBase } from '@twin.org/cli-core';
4
4
  import { mkdir, rm, writeFile } from 'node:fs/promises';
5
5
  import { I18n, GeneralError, Is, StringHelper, ObjectHelper } from '@twin.org/core';
6
- import { JsonSchemaHelper } from '@twin.org/tools-core';
6
+ import { OpenApiHelper, JsonSchemaHelper } from '@twin.org/tools-core';
7
7
  import { HttpStatusCode, MimeTypes } from '@twin.org/web';
8
8
  import { createGenerator } from 'ts-json-schema-generator';
9
9
 
@@ -29,7 +29,7 @@ const HTTP_STATUS_CODE_MAP = {
29
29
  responseType: "IBadRequestResponse",
30
30
  example: {
31
31
  name: "GeneralError",
32
- message: "component.error",
32
+ message: "errorMessage",
33
33
  properties: {
34
34
  foo: "bar"
35
35
  }
@@ -40,7 +40,7 @@ const HTTP_STATUS_CODE_MAP = {
40
40
  responseType: "IUnauthorizedResponse",
41
41
  example: {
42
42
  name: "UnauthorizedError",
43
- message: "component.error"
43
+ message: "errorMessage"
44
44
  }
45
45
  },
46
46
  forbidden: {
@@ -48,7 +48,7 @@ const HTTP_STATUS_CODE_MAP = {
48
48
  responseType: "IForbiddenResponse",
49
49
  example: {
50
50
  name: "NotImplementedError",
51
- message: "component.error",
51
+ message: "errorMessage",
52
52
  properties: {
53
53
  method: "aMethod"
54
54
  }
@@ -59,7 +59,7 @@ const HTTP_STATUS_CODE_MAP = {
59
59
  responseType: "INotFoundResponse",
60
60
  example: {
61
61
  name: "NotFoundError",
62
- message: "component.error",
62
+ message: "errorMessage",
63
63
  properties: {
64
64
  notFoundId: "1"
65
65
  }
@@ -70,7 +70,7 @@ const HTTP_STATUS_CODE_MAP = {
70
70
  responseType: "IConflictResponse",
71
71
  example: {
72
72
  name: "ConflictError",
73
- message: "component.error",
73
+ message: "errorMessage",
74
74
  properties: {
75
75
  conflicts: ["1"]
76
76
  }
@@ -81,7 +81,7 @@ const HTTP_STATUS_CODE_MAP = {
81
81
  responseType: "IInternalServerErrorResponse",
82
82
  example: {
83
83
  name: "InternalServerError",
84
- message: "component.error"
84
+ message: "errorMessage"
85
85
  }
86
86
  },
87
87
  unprocessableEntity: {
@@ -89,7 +89,7 @@ const HTTP_STATUS_CODE_MAP = {
89
89
  responseType: "IUnprocessableEntityResponse",
90
90
  example: {
91
91
  name: "UnprocessableError",
92
- message: "component.error"
92
+ message: "errorMessage"
93
93
  }
94
94
  }
95
95
  };
@@ -193,7 +193,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
193
193
  compilerOptions: {}
194
194
  }, undefined, "\t"));
195
195
  const openApi = {
196
- openapi: "3.1.0",
196
+ openapi: OpenApiHelper.API_VERSION,
197
197
  info: {
198
198
  title: config.title,
199
199
  description: config.description,
@@ -238,7 +238,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
238
238
  }
239
239
  CLIDisplay.task(I18n.formatMessage("commands.ts-to-openapi.progress.generatingSchemas"));
240
240
  const autoExpandTypes = config.autoExpandTypes ?? [];
241
- const defaultExpandTypes = ["ObjectOrArray<.*>"];
241
+ const defaultExpandTypes = ["/ObjectOrArray<.*>/"];
242
242
  for (const defaultType of defaultExpandTypes) {
243
243
  if (!autoExpandTypes.includes(defaultType)) {
244
244
  autoExpandTypes.push(defaultType);
@@ -435,12 +435,13 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
435
435
  if (requestObject?.properties) {
436
436
  // If there are any properties other than body, query, pathParams and headers
437
437
  // we should throw an error as we don't know what to do with them
438
- const otherKeys = Object.keys(requestObject.properties).filter(k => !["body", "query", "pathParams", "headers"].includes(k));
438
+ const otherKeys = Object.keys(requestObject.properties).filter(k => !["body", "query", "pathParams", "headers", "authentication"].includes(k));
439
439
  if (otherKeys.length > 0) {
440
440
  throw new GeneralError("commands", "commands.ts-to-openapi.unsupportedProperties", {
441
441
  keys: otherKeys.join(", ")
442
442
  });
443
443
  }
444
+ delete requestObject.properties.authentication;
444
445
  // If there is a path params object convert these to params
445
446
  if (Is.object(requestObject.properties.pathParams)) {
446
447
  for (const pathParam of pathQueryHeaderParams) {
@@ -597,7 +598,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
597
598
  }
598
599
  }
599
600
  }
600
- await finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, config.externalReferences, outputFile);
601
+ await finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, config.externalReferences, autoExpandTypes, outputFile);
601
602
  }
602
603
  /**
603
604
  * Finalise the schemas and output the spec.
@@ -606,9 +607,10 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
606
607
  * @param openApi The OpenAPI spec.
607
608
  * @param securitySchemes The security schemes.
608
609
  * @param externalReferences The external references.
610
+ * @param autoExpandTypes The auto expand types.
609
611
  * @param outputFile The output file.
610
612
  */
611
- async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, externalReferences, outputFile) {
613
+ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securitySchemes, externalReferences, autoExpandTypes, outputFile) {
612
614
  CLIDisplay.break();
613
615
  CLIDisplay.task(I18n.formatMessage("commands.ts-to-openapi.progress.finalisingSchemas"));
614
616
  // Remove the response codes that we haven't used
@@ -649,6 +651,15 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
649
651
  }
650
652
  }
651
653
  }
654
+ // We can remove any auto expand types from the final schema as they
655
+ // will have been expanded inline so no need to keep them
656
+ for (const autoExpandType of autoExpandTypes) {
657
+ const regExp = JsonSchemaHelper.stringToRegEx(autoExpandType);
658
+ if (regExp.test(schema)) {
659
+ skipSchema = true;
660
+ break;
661
+ }
662
+ }
652
663
  if (!skipSchema) {
653
664
  // If the final schema has no properties and is just a ref to another object type
654
665
  // then replace the references with that of the referenced type
@@ -662,7 +673,6 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
662
673
  if (/I[A-Z]/.test(finalName)) {
663
674
  finalName = finalName.slice(1);
664
675
  }
665
- finalName = finalName.replace("<", "_").replace(">", "_");
666
676
  if (finalName.endsWith("[]")) {
667
677
  finalName = `ListOf${finalName.slice(0, -2)}`;
668
678
  }
@@ -1050,7 +1060,7 @@ class CLI extends CLIBase {
1050
1060
  return this.execute({
1051
1061
  title: "TWIN TypeScript To OpenAPI",
1052
1062
  appName: "ts-to-openapi",
1053
- version: "0.0.2-next.1", // x-release-please-version
1063
+ version: "0.0.2-next.10", // x-release-please-version
1054
1064
  icon: "⚙️ ",
1055
1065
  supportsEnvFiles: false,
1056
1066
  overrideOutputWidth: options?.overrideOutputWidth
@@ -44,8 +44,13 @@
44
44
  "beUrl": "{fieldName} must be a correctly formatted url",
45
45
  "beJSON": "{fieldName} must be correctly formatted JSON",
46
46
  "beEmail": "{fieldName} must be a correctly formatted e-mail address",
47
- "failed": "Validation failed",
48
- "failedObject": "Validation of \"{objectName}\" failed"
47
+ "minLengthRequired": "The value length should be at least {minLength}, it is {actualLength}",
48
+ "maxLengthRequired": "The value length should be at most {maxLength}, it is {actualLength}",
49
+ "repeatedCharacters": "The value should not contain repeated characters in sequence",
50
+ "atLeastOneLowerCase": "The value should contain at least one lowercase character",
51
+ "atLeastOneUpperCase": "The value should contain at least one uppercase character",
52
+ "atLeastOneNumber": "The value should contain at least one number",
53
+ "atLeastOneSpecialChar": "The value should contain at least one symbol"
49
54
  },
50
55
  "guard": {
51
56
  "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
@@ -78,9 +83,7 @@
78
83
  "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
79
84
  "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
80
85
  "length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
81
- "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
82
- "length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
83
- "greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
86
+ "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}"
84
87
  },
85
88
  "objectHelper": {
86
89
  "failedBytesToJSON": "Failed converting bytes to JSON",
@@ -96,7 +99,7 @@
96
99
  "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
97
100
  },
98
101
  "bitString": {
99
- "outOfRange": "The index should be >= 0 and less than the length of the bit string"
102
+ "outOfRange": "The index should be >= 0 and less than the length of the bit string, the index is \"{index}\" and the number of bit is \"{numberBits}\""
100
103
  },
101
104
  "base32": {
102
105
  "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
@@ -111,11 +114,12 @@
111
114
  "failedPatch": "Failed to patch the JSON object, patch index \"{index}\" failed"
112
115
  },
113
116
  "fetchHelper": {
114
- "decodingJSON": "Decoding JSON failed for route \"{route}\"",
117
+ "decodingJSON": "Decoding JSON failed for route \"{url}\"",
115
118
  "failureStatusText": "The request to the API failed: \"{statusText}\"",
116
119
  "connectivity": "The request failed, the API could be offline, or there are other connectivity issues",
117
120
  "timeout": "The request timed out",
118
- "general": "A general failure occurred during the request"
121
+ "general": "A general failure occurred during the request",
122
+ "retryLimitExceeded": "The retry limit was exceeded for route \"{url}\""
119
123
  },
120
124
  "jwt": {
121
125
  "noKeyOrSigner": "No key or signer was provided for JWT creation",
@@ -131,10 +135,6 @@
131
135
  "createFailed": "Failed to create JWS",
132
136
  "verifyFailed": "Failed to verify JWS"
133
137
  },
134
- "bip39": {
135
- "missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
136
- "checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
137
- },
138
138
  "ed25519": {
139
139
  "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
140
140
  "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
@@ -143,13 +143,6 @@
143
143
  "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
144
144
  "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
145
145
  },
146
- "x25519": {
147
- "invalidPublicKey": "Invalid Ed25519 Public Key"
148
- },
149
- "blake2b": {
150
- "outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
151
- "keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
152
- },
153
146
  "sha512": {
154
147
  "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
155
148
  },
@@ -172,17 +165,6 @@
172
165
  "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
173
166
  "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
174
167
  },
175
- "pbkdf2": {
176
- "keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
177
- },
178
- "chaCha20Poly1305": {
179
- "noAadWithData": "You can not set the aad when there is already data",
180
- "noAuthTag": "Can not finalise when the auth tag is not set",
181
- "authenticationFailed": "The data could not be authenticated",
182
- "authTagDecrypting": "Can not get the auth tag when decrypting",
183
- "authTagEncrypting": "Can not set the auth tag when encrypting",
184
- "noAuthTagSet": "The auth tag has not been set"
185
- },
186
168
  "bip44": {
187
169
  "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
188
170
  },
@@ -195,7 +177,6 @@
195
177
  "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
196
178
  "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
197
179
  "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
198
- "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
199
180
  "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
200
181
  "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
201
182
  },
@@ -217,7 +198,8 @@
217
198
  "alreadyExistsError": "Already Exists",
218
199
  "notImplementedError": "Not Implemented",
219
200
  "validationError": "Validation",
220
- "unprocessableError": "Unprocessable"
201
+ "unprocessableError": "Unprocessable",
202
+ "unauthorizedError": "Unauthorized"
221
203
  },
222
204
  "validation": {
223
205
  "defaultFieldName": "The field"
@@ -225,6 +207,11 @@
225
207
  "errorMessages": {
226
208
  "fetch": "Fetch"
227
209
  },
210
+ "warn": {
211
+ "common": {
212
+ "devOnlyTool": "This tool is intended to be used for development purposes, it is not recommended for use in production scenarios."
213
+ }
214
+ },
228
215
  "cli": {
229
216
  "progress": {
230
217
  "done": "Done.",
package/docs/changelog.md CHANGED
@@ -1,5 +1,131 @@
1
1
  # @twin.org/ts-to-openapi - Changelog
2
2
 
3
+ ## [0.0.2-next.10](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.9...ts-to-openapi-v0.0.2-next.10) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([97bb11f](https://github.com/twinfoundation/tools/commit/97bb11fd9e6ed400e7fa69671075ba78f36ca6e6))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/tools-core bumped from 0.0.2-next.9 to 0.0.2-next.10
16
+
17
+ ## [0.0.2-next.9](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.8...ts-to-openapi-v0.0.2-next.9) (2025-09-23)
18
+
19
+
20
+ ### Features
21
+
22
+ * add support for authentication property ([ba002c2](https://github.com/twinfoundation/tools/commit/ba002c2c641618ffe7664269179bca6e9fbc9655))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/tools-core bumped from 0.0.2-next.8 to 0.0.2-next.9
30
+
31
+ ## [0.0.2-next.8](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.7...ts-to-openapi-v0.0.2-next.8) (2025-09-05)
32
+
33
+
34
+ ### Features
35
+
36
+ * tighten the types included with the regex matching ([e54909b](https://github.com/twinfoundation/tools/commit/e54909bded4a19d00560dd3ec783e9146580bda3))
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @twin.org/tools-core bumped from 0.0.2-next.7 to 0.0.2-next.8
44
+
45
+ ## [0.0.2-next.7](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.6...ts-to-openapi-v0.0.2-next.7) (2025-08-29)
46
+
47
+
48
+ ### Features
49
+
50
+ * eslint migration to flat config ([25acfcf](https://github.com/twinfoundation/tools/commit/25acfcf4c4e0c496fffeaf67659fe171bc15199a))
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/tools-core bumped from 0.0.2-next.6 to 0.0.2-next.7
58
+
59
+ ## [0.0.2-next.6](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.5...ts-to-openapi-v0.0.2-next.6) (2025-08-21)
60
+
61
+
62
+ ### Features
63
+
64
+ * remove auto expanded types from final output ([18e05dc](https://github.com/twinfoundation/tools/commit/18e05dc88f71a0a27b79d1d076b1261b42d2c4c2))
65
+
66
+
67
+ ### Dependencies
68
+
69
+ * The following workspace dependencies were updated
70
+ * dependencies
71
+ * @twin.org/tools-core bumped from 0.0.2-next.5 to 0.0.2-next.6
72
+
73
+ ## [0.0.2-next.5](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.4...ts-to-openapi-v0.0.2-next.5) (2025-08-19)
74
+
75
+
76
+ ### Features
77
+
78
+ * correctly handle auto expand types ([57fce0f](https://github.com/twinfoundation/tools/commit/57fce0f9ec4a0876665d70adc6e885f6feb3caf7))
79
+
80
+
81
+ ### Dependencies
82
+
83
+ * The following workspace dependencies were updated
84
+ * dependencies
85
+ * @twin.org/tools-core bumped from 0.0.2-next.4 to 0.0.2-next.5
86
+
87
+ ## [0.0.2-next.4](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.3...ts-to-openapi-v0.0.2-next.4) (2025-08-19)
88
+
89
+
90
+ ### Miscellaneous Chores
91
+
92
+ * **ts-to-openapi:** Synchronize repo versions
93
+
94
+
95
+ ### Dependencies
96
+
97
+ * The following workspace dependencies were updated
98
+ * dependencies
99
+ * @twin.org/tools-core bumped from 0.0.2-next.3 to 0.0.2-next.4
100
+
101
+ ## [0.0.2-next.3](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.2...ts-to-openapi-v0.0.2-next.3) (2025-08-05)
102
+
103
+
104
+ ### Features
105
+
106
+ * improve type name normalisation ([1fe28e5](https://github.com/twinfoundation/tools/commit/1fe28e567593e46a41a833fbba95fe4cd958f525))
107
+
108
+
109
+ ### Dependencies
110
+
111
+ * The following workspace dependencies were updated
112
+ * dependencies
113
+ * @twin.org/tools-core bumped from 0.0.2-next.2 to 0.0.2-next.3
114
+
115
+ ## [0.0.2-next.2](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.1...ts-to-openapi-v0.0.2-next.2) (2025-07-17)
116
+
117
+
118
+ ### Features
119
+
120
+ * improve auto expand types ([6181d1d](https://github.com/twinfoundation/tools/commit/6181d1daded1f91323195cf7efbc2f1881f38b41))
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * The following workspace dependencies were updated
126
+ * dependencies
127
+ * @twin.org/tools-core bumped from 0.0.2-next.1 to 0.0.2-next.2
128
+
3
129
  ## [0.0.2-next.1](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.2-next.0...ts-to-openapi-v0.0.2-next.1) (2025-07-14)
4
130
 
5
131
 
package/docs/examples.md CHANGED
@@ -254,7 +254,7 @@ The generated `output.json` should be:
254
254
  }
255
255
  },
256
256
  {
257
- "name": "pageSize",
257
+ "name": "limit",
258
258
  "description": "The maximum number of entities in a page.",
259
259
  "in": "query",
260
260
  "required": false,
@@ -0,0 +1 @@
1
+ ^errorMessage$
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/ts-to-openapi",
3
- "version": "0.0.2-next.1",
3
+ "version": "0.0.2-next.10",
4
4
  "description": "Tool to convert TypeScript REST route definitions to OpenAPI Specifications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "@twin.org/cli-core": "next",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/nameof": "next",
21
- "@twin.org/tools-core": "0.0.2-next.1",
21
+ "@twin.org/tools-core": "0.0.2-next.10",
22
22
  "@twin.org/web": "next",
23
- "commander": "14.0.0",
24
- "glob": "11.0.2",
23
+ "commander": "14.0.1",
24
+ "glob": "11.0.3",
25
25
  "ts-json-schema-generator": "2.4.0"
26
26
  },
27
27
  "main": "./dist/cjs/index.cjs",
@@ -45,5 +45,17 @@
45
45
  ],
46
46
  "bin": {
47
47
  "ts-to-openapi": "bin/index.js"
48
- }
48
+ },
49
+ "keywords": [
50
+ "twin",
51
+ "trade",
52
+ "iota",
53
+ "framework",
54
+ "blockchain",
55
+ "tools"
56
+ ],
57
+ "bugs": {
58
+ "url": "git+https://github.com/twinfoundation/tools/issues"
59
+ },
60
+ "homepage": "https://twindev.org"
49
61
  }
@@ -1,54 +0,0 @@
1
- import type { IJsonSchema } from "@twin.org/tools-core";
2
- import type { IOpenApiPathMethod } from "./IOpenApiPathMethod";
3
- import type { IOpenApiSecurityScheme } from "./IOpenApiSecurityScheme";
4
- /**
5
- * The Open API config definition.
6
- */
7
- export interface IOpenApi {
8
- /**
9
- * The open api version.
10
- */
11
- openapi: string;
12
- /**
13
- * Info.
14
- */
15
- info: {
16
- title: string;
17
- version: string;
18
- description: string;
19
- license?: {
20
- name: string;
21
- url: string;
22
- };
23
- };
24
- /**
25
- * The servers for the endpoints.
26
- */
27
- servers?: {
28
- url: string;
29
- }[];
30
- /**
31
- * Tags for the endpoints.
32
- */
33
- tags?: {
34
- name: string;
35
- description: string;
36
- }[];
37
- /**
38
- * The paths.
39
- */
40
- paths: {
41
- [path: string]: {
42
- [method: string]: IOpenApiPathMethod;
43
- };
44
- };
45
- /**
46
- * The components.
47
- */
48
- components?: {
49
- schemas?: IJsonSchema;
50
- securitySchemes?: {
51
- [name: string]: IOpenApiSecurityScheme;
52
- };
53
- };
54
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * The Open API config definition.
3
- */
4
- export interface IOpenApiExample {
5
- /**
6
- * The summary of the example.
7
- */
8
- summary?: string;
9
- /**
10
- * The value of the example.
11
- */
12
- value: unknown;
13
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * The Open API config definition.
3
- */
4
- export interface IOpenApiHeader {
5
- /**
6
- * The schema of the header.
7
- */
8
- schema?: {
9
- type: string;
10
- };
11
- /**
12
- * The description of the header.
13
- */
14
- description?: string;
15
- /**
16
- * The format of the header.
17
- */
18
- format?: string;
19
- }
@@ -1,64 +0,0 @@
1
- import type { IJsonSchema, JsonTypeName } from "@twin.org/tools-core";
2
- import type { IOpenApiExample } from "./IOpenApiExample";
3
- import type { IOpenApiResponse } from "./IOpenApiResponse";
4
- /**
5
- * The Open API config definition.
6
- */
7
- export interface IOpenApiPathMethod {
8
- /**
9
- * The operation id.
10
- */
11
- operationId: string;
12
- /**
13
- * Summary.
14
- */
15
- summary: string;
16
- /**
17
- * Tags.
18
- */
19
- tags?: string[];
20
- /**
21
- * Parameters.
22
- */
23
- parameters?: {
24
- name: string;
25
- in: string;
26
- description?: string;
27
- required: boolean;
28
- schema: {
29
- type?: JsonTypeName | JsonTypeName[];
30
- enum?: IJsonSchema[];
31
- $ref?: string;
32
- };
33
- style?: string;
34
- }[];
35
- /**
36
- * Request body.
37
- */
38
- requestBody?: {
39
- required: boolean;
40
- description?: string;
41
- content?: {
42
- [contentType: string]: {
43
- schema: {
44
- $ref: string;
45
- };
46
- examples?: {
47
- [id: string]: IOpenApiExample;
48
- };
49
- };
50
- };
51
- };
52
- /**
53
- * Response body.
54
- */
55
- responses?: {
56
- [code: string]: IOpenApiResponse;
57
- };
58
- /**
59
- * Security model for the API.
60
- */
61
- security?: {
62
- [name: string]: string[];
63
- }[];
64
- }
@@ -1,32 +0,0 @@
1
- import type { IOpenApiExample } from "./IOpenApiExample";
2
- import type { IOpenApiHeader } from "./IOpenApiHeader";
3
- /**
4
- * The Open API config definition.
5
- */
6
- export interface IOpenApiResponse {
7
- /**
8
- * Descriptions for the response.
9
- */
10
- description?: string;
11
- /**
12
- * Content for the response.
13
- */
14
- content?: {
15
- [contentType: string]: {
16
- schema: {
17
- type?: string;
18
- format?: string;
19
- $ref?: string;
20
- };
21
- examples?: {
22
- [id: string]: IOpenApiExample;
23
- };
24
- };
25
- };
26
- /**
27
- * The headers for the response.
28
- */
29
- headers?: {
30
- [id: string]: IOpenApiHeader;
31
- };
32
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * The Open API config definition for security scheme.
3
- */
4
- export interface IOpenApiSecurityScheme {
5
- /**
6
- * The type of the security schema.
7
- */
8
- type?: string;
9
- /**
10
- * The scheme method.
11
- */
12
- scheme?: string;
13
- /**
14
- * The bearer format.
15
- */
16
- bearerFormat?: string;
17
- /**
18
- * Where is the token located.
19
- */
20
- in?: string;
21
- /**
22
- * What is the name of the token.
23
- */
24
- name?: string;
25
- }