@twin.org/ts-to-openapi 0.0.2-next.8 → 0.0.3-next.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.
Files changed (36) hide show
  1. package/bin/index.js +1 -1
  2. package/dist/es/cli.js +37 -0
  3. package/dist/es/cli.js.map +1 -0
  4. package/dist/es/commands/httpStatusCodeMap.js +115 -0
  5. package/dist/es/commands/httpStatusCodeMap.js.map +1 -0
  6. package/dist/{esm/index.mjs → es/commands/tsToOpenApi.js} +27 -168
  7. package/dist/es/commands/tsToOpenApi.js.map +1 -0
  8. package/dist/es/index.js +7 -0
  9. package/dist/es/index.js.map +1 -0
  10. package/dist/es/models/IInputPath.js +2 -0
  11. package/dist/es/models/IInputPath.js.map +1 -0
  12. package/dist/es/models/IInputResult.js +2 -0
  13. package/dist/es/models/IInputResult.js.map +1 -0
  14. package/dist/es/models/IRestRoute.js +2 -0
  15. package/dist/es/models/IRestRoute.js.map +1 -0
  16. package/dist/es/models/IRestRouteEntryPoints.js +2 -0
  17. package/dist/es/models/IRestRouteEntryPoints.js.map +1 -0
  18. package/dist/es/models/ITag.js +4 -0
  19. package/dist/es/models/ITag.js.map +1 -0
  20. package/dist/es/models/ITsToOpenApiConfig.js +2 -0
  21. package/dist/es/models/ITsToOpenApiConfig.js.map +1 -0
  22. package/dist/es/models/ITsToOpenApiConfigEntryPoint.js +4 -0
  23. package/dist/es/models/ITsToOpenApiConfigEntryPoint.js.map +1 -0
  24. package/dist/locales/en.json +46 -73
  25. package/dist/types/commands/tsToOpenApi.d.ts +1 -1
  26. package/dist/types/index.d.ts +4 -4
  27. package/dist/types/models/IInputResult.d.ts +11 -3
  28. package/dist/types/models/IRestRoute.d.ts +98 -0
  29. package/dist/types/models/IRestRouteEntryPoints.d.ts +23 -0
  30. package/dist/types/models/ITag.d.ts +13 -0
  31. package/dist/types/models/ITsToOpenApiConfig.d.ts +1 -1
  32. package/docs/changelog.md +64 -0
  33. package/docs/examples.md +1 -1
  34. package/locales/.validate-ignore +1 -0
  35. package/package.json +20 -11
  36. package/dist/cjs/index.cjs +0 -1083
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IInputPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IInputPath.js","sourceRoot":"","sources":["../../../src/models/IInputPath.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpMethod, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The resulting details for a REST path.\n */\nexport interface IInputPath {\n\t/**\n\t * The path.\n\t */\n\tpath: string;\n\n\t/**\n\t * The REST method.\n\t */\n\tmethod: HttpMethod;\n\n\t/**\n\t * The parameters contained in the path.\n\t */\n\tpathParameters: string[];\n\n\t/**\n\t * The id of the operation.\n\t */\n\toperationId: string;\n\n\t/**\n\t * Summary of what task the operation performs.\n\t */\n\tsummary: string;\n\n\t/**\n\t * Tags for the operation.\n\t */\n\ttag: string;\n\n\t/**\n\t * The request type.\n\t */\n\trequestType?: string;\n\n\t/**\n\t * The request mime type.\n\t */\n\trequestMimeType?: string;\n\n\t/**\n\t * Example objects for the request.\n\t */\n\trequestExamples?: {\n\t\tid: string;\n\t\tdescription?: string;\n\t\trequest: unknown;\n\t}[];\n\n\t/**\n\t * The response type.\n\t */\n\tresponseType: {\n\t\tstatusCode: HttpStatusCode;\n\t\ttype: string;\n\t\tmimeType?: string;\n\t\tdescription?: string;\n\t\texamples?: {\n\t\t\tid: string;\n\t\t\tdescription?: string;\n\t\t\tresponse: unknown;\n\t\t}[];\n\t}[];\n\n\t/**\n\t * Response codes.\n\t */\n\tresponseCodes: string[];\n\n\t/**\n\t * Skip authentication for this path.\n\t */\n\tskipAuth: boolean;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IInputResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IInputResult.js","sourceRoot":"","sources":["../../../src/models/IInputResult.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IInputPath } from \"./IInputPath.js\";\n\n/**\n * The set of path results for a package.\n */\nexport interface IInputResult {\n\t/**\n\t * The paths.\n\t */\n\tpaths: IInputPath[];\n\n\t/**\n\t * The tags.\n\t */\n\ttags: {\n\t\t/**\n\t\t * The name of the tag.\n\t\t */\n\t\tname: string;\n\n\t\t/**\n\t\t * Description for the tag.\n\t\t */\n\t\tdescription: string;\n\t}[];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IRestRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRestRoute.js","sourceRoot":"","sources":["../../../src/models/IRestRoute.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpMethod } from \"@twin.org/web\";\n\n/**\n * Interface which defines a REST route.\n */\nexport interface IRestRoute {\n\t/**\n\t * The id of the operation.\n\t */\n\toperationId: string;\n\n\t/**\n\t * The path to use for routing.\n\t */\n\tpath: string;\n\n\t/**\n\t * Skips the authentication for this route.\n\t */\n\tskipAuth?: boolean;\n\n\t/**\n\t * Summary of what task the operation performs.\n\t */\n\tsummary: string;\n\n\t/**\n\t * Tag for the operation.\n\t */\n\ttag: string;\n\n\t/**\n\t * The http method.\n\t */\n\tmethod: HttpMethod;\n\n\t/**\n\t * The type of the request object.\n\t */\n\trequestType?: {\n\t\t/**\n\t\t * The object type for the request.\n\t\t */\n\t\ttype: string;\n\n\t\t/**\n\t\t * The mime type of the request, defaults to \"application/json\" if there is a body.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Example objects for the request.\n\t\t */\n\t\texamples?: {\n\t\t\t/**\n\t\t\t * Example objects for the request.\n\t\t\t */\n\t\t\tid: string;\n\n\t\t\t/**\n\t\t\t * Description of the example.\n\t\t\t */\n\t\t\tdescription?: string;\n\n\t\t\t/**\n\t\t\t * The example request object.\n\t\t\t */\n\t\t\trequest: unknown;\n\t\t}[];\n\t};\n\n\t/**\n\t * The type of the response object.\n\t */\n\tresponseType?: {\n\t\t/**\n\t\t * The object type of the response.\n\t\t */\n\t\ttype: string;\n\n\t\t/**\n\t\t * The mime type of the response, defaults to \"application/json\" if there is a body.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Example objects of the response.\n\t\t */\n\t\texamples?: {\n\t\t\t/**\n\t\t\t * Example objects for the request.\n\t\t\t */\n\t\t\tid: string;\n\n\t\t\t/**\n\t\t\t * Description of the example.\n\t\t\t */\n\t\t\tdescription?: string;\n\n\t\t\t/**\n\t\t\t * The example response object.\n\t\t\t */\n\t\t\tresponse: unknown;\n\t\t}[];\n\t}[];\n\n\t/**\n\t * Exclude the route from being included in the spec file.\n\t */\n\texcludeFromSpec?: boolean;\n\n\t/**\n\t * The handler module.\n\t */\n\thandler: () => Promise<unknown>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IRestRouteEntryPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRestRouteEntryPoints.js","sourceRoot":"","sources":["../../../src/models/IRestRouteEntryPoints.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRoute } from \"./IRestRoute.js\";\nimport type { ITag } from \"./ITag.js\";\n\n/**\n * Route entry points are used for exposing the routes from a package.\n */\nexport interface IRestRouteEntryPoint {\n\t/**\n\t * The name of the routes.\n\t */\n\tname: string;\n\n\t/**\n\t * The default base route name for the routes.\n\t */\n\tdefaultBaseRoute: string;\n\n\t/**\n\t * The tags for the routes.\n\t */\n\ttags: ITag[];\n\n\t/**\n\t * The method to generate the routes.\n\t */\n\tgenerateRoutes: (baseRouteName: string, componentName: string) => IRestRoute[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=ITag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITag.js","sourceRoot":"","sources":["../../../src/models/ITag.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Tag for routes used to generate OpenAPI information.\n */\nexport interface ITag {\n\t/**\n\t * The name of the tag.\n\t */\n\tname: string;\n\n\t/**\n\t * Description for the tag.\n\t */\n\tdescription: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ITsToOpenApiConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITsToOpenApiConfig.js","sourceRoot":"","sources":["../../../src/models/ITsToOpenApiConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonSchema } from \"@twin.org/tools-core\";\nimport type { ITsToOpenApiConfigEntryPoint } from \"./ITsToOpenApiConfigEntryPoint.js\";\n\n/**\n * Configuration for the API.\n */\nexport interface ITsToOpenApiConfig {\n\t/**\n\t * Title of the API.\n\t */\n\ttitle: string;\n\n\t/**\n\t * The version.\n\t */\n\tversion: string;\n\n\t/**\n\t * Description of the API.\n\t */\n\tdescription: string;\n\n\t/**\n\t * The license to use.\n\t */\n\tlicenseName: string;\n\n\t/**\n\t * The license URL.\n\t */\n\tlicenseUrl: string;\n\n\t/**\n\t * The servers for the endpoints.\n\t */\n\tservers: string[];\n\n\t/**\n\t * The authentication methods.\n\t */\n\tauthMethods?: (\"basic\" | \"jwtBearer\" | \"jwtCookie\" | string)[];\n\n\t/**\n\t * The packages containing routes.\n\t */\n\trestRoutes: {\n\t\t/**\n\t\t * The package containing the routes.\n\t\t */\n\t\tpackage?: string;\n\n\t\t/**\n\t\t * The version of the package to use, defaults to latest.\n\t\t */\n\t\tversion?: string;\n\n\t\t/**\n\t\t * To point to a local instance of a package use this property instead of package/version.\n\t\t */\n\t\tpackageRoot?: string;\n\n\t\t/**\n\t\t * The rest entry points to include, defaults to all exported entry points.\n\t\t */\n\t\tentryPoints?: ITsToOpenApiConfigEntryPoint[];\n\t}[];\n\n\t/**\n\t * External type references\n\t */\n\texternalReferences?: { [id: string]: string };\n\n\t/**\n\t * Override for specific types, to be used when the type cannot be generated automatically, or is generated incorrectly.\n\t */\n\toverrides?: {\n\t\t[id: string]: IJsonSchema;\n\t};\n\n\t/**\n\t * The types to automatically expand inline in type definitions, reg ex string matches.\n\t */\n\tautoExpandTypes?: string[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=ITsToOpenApiConfigEntryPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITsToOpenApiConfigEntryPoint.js","sourceRoot":"","sources":["../../../src/models/ITsToOpenApiConfigEntryPoint.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the API.\n */\nexport interface ITsToOpenApiConfigEntryPoint {\n\t/**\n\t * Match the name of the exported entry point.\n\t */\n\tname: string;\n\n\t/**\n\t * The base route path to use, defaults to the one in the entry point.\n\t */\n\tbaseRoutePath?: string;\n\n\t/**\n\t * If using the same routes on multiple paths use the distinguisher to avoid operationId clashes, will be appended to operationIds.\n\t */\n\toperationIdDistinguisher?: string;\n}\n"]}
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "error": {
3
- "baseRestClient": {
4
- "missingRouteProp": "Missing route parameter in data \"{routeProp}\" for route \"{route}\"",
5
- "decodingFailed": "Decoding JSON failed for route \"{route}\"",
6
- "failureStatusText": "The request to the API failed: \"{statusText}\""
3
+ "commands": {
4
+ "common": {
5
+ "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
6
+ "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
7
+ "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
8
+ "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
9
+ "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
10
+ "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
11
+ },
12
+ "ts-to-openapi": {
13
+ "configFailed": "Configuration failed to load.",
14
+ "missingRestRoutesEntryPoints": "Missing REST routes method \"{method}\" in package \"{package}\".",
15
+ "missingRestRoutesEntryPoint": "Missing REST routes entryPoint \"{entryPoint}\" in package \"{package}\".",
16
+ "unsupportedProperties": "Unsupported properties found in the request object \"{keys}\"."
17
+ }
7
18
  },
8
19
  "validation": {
9
20
  "beEmpty": "{fieldName} must be empty",
@@ -44,8 +55,13 @@
44
55
  "beUrl": "{fieldName} must be a correctly formatted url",
45
56
  "beJSON": "{fieldName} must be correctly formatted JSON",
46
57
  "beEmail": "{fieldName} must be a correctly formatted e-mail address",
47
- "failed": "Validation failed",
48
- "failedObject": "Validation of \"{objectName}\" failed"
58
+ "minLengthRequired": "The value length should be at least {minLength}, it is {actualLength}",
59
+ "maxLengthRequired": "The value length should be at most {maxLength}, it is {actualLength}",
60
+ "repeatedCharacters": "The value should not contain repeated characters in sequence",
61
+ "atLeastOneLowerCase": "The value should contain at least one lowercase character",
62
+ "atLeastOneUpperCase": "The value should contain at least one uppercase character",
63
+ "atLeastOneNumber": "The value should contain at least one number",
64
+ "atLeastOneSpecialChar": "The value should contain at least one symbol"
49
65
  },
50
66
  "guard": {
51
67
  "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
@@ -78,9 +94,7 @@
78
94
  "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
79
95
  "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
80
96
  "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}"
97
+ "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}"
84
98
  },
85
99
  "objectHelper": {
86
100
  "failedBytesToJSON": "Failed converting bytes to JSON",
@@ -96,7 +110,7 @@
96
110
  "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
97
111
  },
98
112
  "bitString": {
99
- "outOfRange": "The index should be >= 0 and less than the length of the bit string"
113
+ "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
114
  },
101
115
  "base32": {
102
116
  "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
@@ -111,11 +125,12 @@
111
125
  "failedPatch": "Failed to patch the JSON object, patch index \"{index}\" failed"
112
126
  },
113
127
  "fetchHelper": {
114
- "decodingJSON": "Decoding JSON failed for route \"{route}\"",
128
+ "decodingJSON": "Decoding JSON failed for route \"{url}\"",
115
129
  "failureStatusText": "The request to the API failed: \"{statusText}\"",
116
130
  "connectivity": "The request failed, the API could be offline, or there are other connectivity issues",
117
131
  "timeout": "The request timed out",
118
- "general": "A general failure occurred during the request"
132
+ "general": "A general failure occurred during the request",
133
+ "retryLimitExceeded": "The retry limit was exceeded for route \"{url}\""
119
134
  },
120
135
  "jwt": {
121
136
  "noKeyOrSigner": "No key or signer was provided for JWT creation",
@@ -131,10 +146,6 @@
131
146
  "createFailed": "Failed to create JWS",
132
147
  "verifyFailed": "Failed to verify JWS"
133
148
  },
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
149
  "ed25519": {
139
150
  "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
140
151
  "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
@@ -143,13 +154,6 @@
143
154
  "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
144
155
  "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
145
156
  },
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
157
  "sha512": {
154
158
  "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
155
159
  },
@@ -172,63 +176,13 @@
172
176
  "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
173
177
  "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
174
178
  },
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
179
  "bip44": {
187
180
  "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
188
181
  },
189
182
  "slip0010": {
190
183
  "invalidSeed": "The seed is invalid \"{seed}\""
191
- },
192
- "rsa": {
193
- "noPrivateKey": "Private key is required for this operation",
194
- "invalidKeySize": "Invalid RSA key size"
195
- },
196
- "commands": {
197
- "common": {
198
- "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
199
- "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
200
- "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
201
- "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
202
- "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
203
- "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
204
- "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
205
- },
206
- "ts-to-openapi": {
207
- "configFailed": "Configuration failed to load.",
208
- "missingRestRoutesEntryPoints": "Missing REST routes method \"{method}\" in package \"{package}\".",
209
- "missingRestRoutesEntryPoint": "Missing REST routes entryPoint \"{entryPoint}\" in package \"{package}\".",
210
- "unsupportedProperties": "Unsupported properties found in the request object \"{keys}\"."
211
- }
212
184
  }
213
185
  },
214
- "errorNames": {
215
- "error": "Error",
216
- "generalError": "General",
217
- "guardError": "Guard",
218
- "conflictError": "Conflict",
219
- "notFoundError": "Not Found",
220
- "notSupportedError": "Not Supported",
221
- "alreadyExistsError": "Already Exists",
222
- "notImplementedError": "Not Implemented",
223
- "validationError": "Validation",
224
- "unprocessableError": "Unprocessable"
225
- },
226
- "validation": {
227
- "defaultFieldName": "The field"
228
- },
229
- "errorMessages": {
230
- "fetch": "Fetch"
231
- },
232
186
  "warn": {
233
187
  "common": {
234
188
  "devOnlyTool": "This tool is intended to be used for development purposes, it is not recommended for use in production scenarios."
@@ -276,6 +230,25 @@
276
230
  }
277
231
  }
278
232
  },
233
+ "errorNames": {
234
+ "error": "Error",
235
+ "generalError": "General",
236
+ "guardError": "Guard",
237
+ "conflictError": "Conflict",
238
+ "notFoundError": "Not Found",
239
+ "notSupportedError": "Not Supported",
240
+ "alreadyExistsError": "Already Exists",
241
+ "notImplementedError": "Not Implemented",
242
+ "validationError": "Validation",
243
+ "unprocessableError": "Unprocessable",
244
+ "unauthorizedError": "Unauthorized"
245
+ },
246
+ "validation": {
247
+ "defaultFieldName": "The field"
248
+ },
249
+ "errorMessages": {
250
+ "fetch": "Fetch"
251
+ },
279
252
  "commands": {
280
253
  "ts-to-openapi": {
281
254
  "options": {
@@ -1,5 +1,5 @@
1
1
  import type { Command } from "commander";
2
- import type { ITsToOpenApiConfig } from "../models/ITsToOpenApiConfig";
2
+ import type { ITsToOpenApiConfig } from "../models/ITsToOpenApiConfig.js";
3
3
  /**
4
4
  * Build the root command to be consumed by the CLI.
5
5
  * @param program The command to build on.
@@ -1,4 +1,4 @@
1
- export * from "./cli";
2
- export * from "./commands/tsToOpenApi";
3
- export * from "./models/ITsToOpenApiConfig";
4
- export * from "./models/ITsToOpenApiConfigEntryPoint";
1
+ export * from "./cli.js";
2
+ export * from "./commands/tsToOpenApi.js";
3
+ export * from "./models/ITsToOpenApiConfig.js";
4
+ export * from "./models/ITsToOpenApiConfigEntryPoint.js";
@@ -1,5 +1,4 @@
1
- import type { ITag } from "@twin.org/api-models";
2
- import type { IInputPath } from "./IInputPath";
1
+ import type { IInputPath } from "./IInputPath.js";
3
2
  /**
4
3
  * The set of path results for a package.
5
4
  */
@@ -11,5 +10,14 @@ export interface IInputResult {
11
10
  /**
12
11
  * The tags.
13
12
  */
14
- tags: ITag[];
13
+ tags: {
14
+ /**
15
+ * The name of the tag.
16
+ */
17
+ name: string;
18
+ /**
19
+ * Description for the tag.
20
+ */
21
+ description: string;
22
+ }[];
15
23
  }
@@ -0,0 +1,98 @@
1
+ import type { HttpMethod } from "@twin.org/web";
2
+ /**
3
+ * Interface which defines a REST route.
4
+ */
5
+ export interface IRestRoute {
6
+ /**
7
+ * The id of the operation.
8
+ */
9
+ operationId: string;
10
+ /**
11
+ * The path to use for routing.
12
+ */
13
+ path: string;
14
+ /**
15
+ * Skips the authentication for this route.
16
+ */
17
+ skipAuth?: boolean;
18
+ /**
19
+ * Summary of what task the operation performs.
20
+ */
21
+ summary: string;
22
+ /**
23
+ * Tag for the operation.
24
+ */
25
+ tag: string;
26
+ /**
27
+ * The http method.
28
+ */
29
+ method: HttpMethod;
30
+ /**
31
+ * The type of the request object.
32
+ */
33
+ requestType?: {
34
+ /**
35
+ * The object type for the request.
36
+ */
37
+ type: string;
38
+ /**
39
+ * The mime type of the request, defaults to "application/json" if there is a body.
40
+ */
41
+ mimeType?: string;
42
+ /**
43
+ * Example objects for the request.
44
+ */
45
+ examples?: {
46
+ /**
47
+ * Example objects for the request.
48
+ */
49
+ id: string;
50
+ /**
51
+ * Description of the example.
52
+ */
53
+ description?: string;
54
+ /**
55
+ * The example request object.
56
+ */
57
+ request: unknown;
58
+ }[];
59
+ };
60
+ /**
61
+ * The type of the response object.
62
+ */
63
+ responseType?: {
64
+ /**
65
+ * The object type of the response.
66
+ */
67
+ type: string;
68
+ /**
69
+ * The mime type of the response, defaults to "application/json" if there is a body.
70
+ */
71
+ mimeType?: string;
72
+ /**
73
+ * Example objects of the response.
74
+ */
75
+ examples?: {
76
+ /**
77
+ * Example objects for the request.
78
+ */
79
+ id: string;
80
+ /**
81
+ * Description of the example.
82
+ */
83
+ description?: string;
84
+ /**
85
+ * The example response object.
86
+ */
87
+ response: unknown;
88
+ }[];
89
+ }[];
90
+ /**
91
+ * Exclude the route from being included in the spec file.
92
+ */
93
+ excludeFromSpec?: boolean;
94
+ /**
95
+ * The handler module.
96
+ */
97
+ handler: () => Promise<unknown>;
98
+ }
@@ -0,0 +1,23 @@
1
+ import type { IRestRoute } from "./IRestRoute.js";
2
+ import type { ITag } from "./ITag.js";
3
+ /**
4
+ * Route entry points are used for exposing the routes from a package.
5
+ */
6
+ export interface IRestRouteEntryPoint {
7
+ /**
8
+ * The name of the routes.
9
+ */
10
+ name: string;
11
+ /**
12
+ * The default base route name for the routes.
13
+ */
14
+ defaultBaseRoute: string;
15
+ /**
16
+ * The tags for the routes.
17
+ */
18
+ tags: ITag[];
19
+ /**
20
+ * The method to generate the routes.
21
+ */
22
+ generateRoutes: (baseRouteName: string, componentName: string) => IRestRoute[];
23
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tag for routes used to generate OpenAPI information.
3
+ */
4
+ export interface ITag {
5
+ /**
6
+ * The name of the tag.
7
+ */
8
+ name: string;
9
+ /**
10
+ * Description for the tag.
11
+ */
12
+ description: string;
13
+ }
@@ -1,5 +1,5 @@
1
1
  import type { IJsonSchema } from "@twin.org/tools-core";
2
- import type { ITsToOpenApiConfigEntryPoint } from "./ITsToOpenApiConfigEntryPoint";
2
+ import type { ITsToOpenApiConfigEntryPoint } from "./ITsToOpenApiConfigEntryPoint.js";
3
3
  /**
4
4
  * Configuration for the API.
5
5
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # @twin.org/ts-to-openapi - Changelog
2
2
 
3
+ ## [0.0.3-next.1](https://github.com/twinfoundation/tools/compare/ts-to-openapi-v0.0.3-next.0...ts-to-openapi-v0.0.3-next.1) (2025-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#54](https://github.com/twinfoundation/tools/issues/54)) ([41ad65d](https://github.com/twinfoundation/tools/commit/41ad65d5ae33d0533d32a2864cd94e5c35e56c76))
9
+ * add latest json schema features ([494293f](https://github.com/twinfoundation/tools/commit/494293f4252b9c7d4a20790ec157fc9d8c96c3d2))
10
+ * add support for authentication property ([ba002c2](https://github.com/twinfoundation/tools/commit/ba002c2c641618ffe7664269179bca6e9fbc9655))
11
+ * add support for auto expand types ([dd1e10a](https://github.com/twinfoundation/tools/commit/dd1e10a5b2fea6f80890ff6f3971f48e239cb4c1))
12
+ * add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
13
+ * add validate-locales ([97bb11f](https://github.com/twinfoundation/tools/commit/97bb11fd9e6ed400e7fa69671075ba78f36ca6e6))
14
+ * correctly handle auto expand types ([57fce0f](https://github.com/twinfoundation/tools/commit/57fce0f9ec4a0876665d70adc6e885f6feb3caf7))
15
+ * eslint migration to flat config ([25acfcf](https://github.com/twinfoundation/tools/commit/25acfcf4c4e0c496fffeaf67659fe171bc15199a))
16
+ * generate schemas as individual entities ([9f372ab](https://github.com/twinfoundation/tools/commit/9f372abdfc27aba93b303c7b214991919c0c18c3))
17
+ * improve auto expand types ([6181d1d](https://github.com/twinfoundation/tools/commit/6181d1daded1f91323195cf7efbc2f1881f38b41))
18
+ * improve schema type name normalisation ([1a18b26](https://github.com/twinfoundation/tools/commit/1a18b267d87e9179bda01b396b256c450ae2889e))
19
+ * improve type name normalisation ([1fe28e5](https://github.com/twinfoundation/tools/commit/1fe28e567593e46a41a833fbba95fe4cd958f525))
20
+ * move package to framework repo ([4490bda](https://github.com/twinfoundation/tools/commit/4490bda472d4dc8ddfe931e2fce81f3411de9ab3))
21
+ * remove auto expanded types from final output ([18e05dc](https://github.com/twinfoundation/tools/commit/18e05dc88f71a0a27b79d1d076b1261b42d2c4c2))
22
+ * strip Omit types ([3a079f9](https://github.com/twinfoundation/tools/commit/3a079f9abe8127c5b44a2b9382babf2f19629d08))
23
+ * tighten the types included with the regex matching ([e54909b](https://github.com/twinfoundation/tools/commit/e54909bded4a19d00560dd3ec783e9146580bda3))
24
+ * use most recent JSON schema specs ([4598cbf](https://github.com/twinfoundation/tools/commit/4598cbf29f7b82dba4a9f3b19f81dfe66f5a6060))
25
+ * use shared store mechanism ([#31](https://github.com/twinfoundation/tools/issues/31)) ([d9fe68b](https://github.com/twinfoundation/tools/commit/d9fe68b903d1268c7cb3c64772df5cb78fd63667))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * fix locale resource name ([53ad5b5](https://github.com/twinfoundation/tools/commit/53ad5b56f19a5082f16a4f1e4a761e114dce8250))
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * The following workspace dependencies were updated
36
+ * dependencies
37
+ * @twin.org/tools-core bumped from 0.0.3-next.0 to 0.0.3-next.1
38
+
39
+ ## [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)
40
+
41
+
42
+ ### Features
43
+
44
+ * add validate-locales ([97bb11f](https://github.com/twinfoundation/tools/commit/97bb11fd9e6ed400e7fa69671075ba78f36ca6e6))
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * The following workspace dependencies were updated
50
+ * dependencies
51
+ * @twin.org/tools-core bumped from 0.0.2-next.9 to 0.0.2-next.10
52
+
53
+ ## [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)
54
+
55
+
56
+ ### Features
57
+
58
+ * add support for authentication property ([ba002c2](https://github.com/twinfoundation/tools/commit/ba002c2c641618ffe7664269179bca6e9fbc9655))
59
+
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @twin.org/tools-core bumped from 0.0.2-next.8 to 0.0.2-next.9
66
+
3
67
  ## [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)
4
68
 
5
69
 
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.8",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Tool to convert TypeScript REST route definitions to OpenAPI Specifications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,30 +14,27 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-models": "next",
18
17
  "@twin.org/cli-core": "next",
19
18
  "@twin.org/core": "next",
20
19
  "@twin.org/nameof": "next",
21
- "@twin.org/tools-core": "0.0.2-next.8",
20
+ "@twin.org/tools-core": "0.0.3-next.1",
22
21
  "@twin.org/web": "next",
23
- "commander": "14.0.0",
22
+ "commander": "14.0.2",
24
23
  "glob": "11.0.3",
25
24
  "ts-json-schema-generator": "2.4.0"
26
25
  },
27
- "main": "./dist/cjs/index.cjs",
28
- "module": "./dist/esm/index.mjs",
26
+ "main": "./dist/es/index.js",
29
27
  "types": "./dist/types/index.d.ts",
30
28
  "exports": {
31
29
  ".": {
32
30
  "types": "./dist/types/index.d.ts",
33
- "require": "./dist/cjs/index.cjs",
34
- "import": "./dist/esm/index.mjs"
31
+ "import": "./dist/es/index.js",
32
+ "default": "./dist/es/index.js"
35
33
  }
36
34
  },
37
35
  "files": [
38
36
  "bin",
39
- "dist/cjs",
40
- "dist/esm",
37
+ "dist/es",
41
38
  "dist/locales",
42
39
  "dist/types",
43
40
  "locales",
@@ -45,5 +42,17 @@
45
42
  ],
46
43
  "bin": {
47
44
  "ts-to-openapi": "bin/index.js"
48
- }
45
+ },
46
+ "keywords": [
47
+ "twin",
48
+ "trade",
49
+ "iota",
50
+ "framework",
51
+ "blockchain",
52
+ "tools"
53
+ ],
54
+ "bugs": {
55
+ "url": "git+https://github.com/twinfoundation/tools/issues"
56
+ },
57
+ "homepage": "https://twindev.org"
49
58
  }