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

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.
@@ -698,6 +698,8 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
698
698
  json = json.replace(/#\/components\/schemas\/(.*)\[\]/g, "#/components/schemas/ListOf$1");
699
699
  // Remove the partial markers
700
700
  json = json.replace(/Partial%3CI(.*?)%3E/g, "$1");
701
+ // Remove the omit markers
702
+ json = json.replace(/Omit%3CI(.*?)%2C.*%3E/g, "$1");
701
703
  // Cleanup the generic markers
702
704
  json = json.replace(/%3Cunknown%3E/g, "");
703
705
  // Remove external references
@@ -855,6 +857,8 @@ async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
855
857
  for (const def in schema.definitions) {
856
858
  // Remove the partial markers
857
859
  let defSub = def.replace(/^Partial<(.*?)>/g, "$1");
860
+ // Remove the omit markers
861
+ defSub = defSub.replace(/^Omit<(.*?),.*>/g, "$1");
858
862
  // Cleanup the generic markers
859
863
  defSub = defSub.replace(/</g, "%3C").replace(/>/g, "%3E");
860
864
  allSchemas[defSub] = schema.definitions[def];
@@ -898,7 +902,10 @@ function extractTypes(allSchemas, requiredTypes, referencedSchemas) {
898
902
  function extractTypesFromSchema(allTypes, schema, output) {
899
903
  const additionalTypes = [];
900
904
  if (core.Is.stringValue(schema.$ref)) {
901
- additionalTypes.push(schema.$ref.replace("#/definitions/", "").replace(/^Partial%3C(.*?)%3E/g, "$1"));
905
+ additionalTypes.push(schema.$ref
906
+ .replace("#/definitions/", "")
907
+ .replace(/^Partial%3C(.*?)%3E/g, "$1")
908
+ .replace(/^Omit%3C(.*?)%2C.*%3E/g, "$1"));
902
909
  }
903
910
  else if (core.Is.object(schema.items)) {
904
911
  if (core.Is.arrayValue(schema.items)) {
@@ -1110,7 +1117,7 @@ class CLI extends cliCore.CLIBase {
1110
1117
  return this.execute({
1111
1118
  title: "TWIN TypeScript To OpenAPI",
1112
1119
  appName: "ts-to-openapi",
1113
- version: "0.0.1-next.23", // x-release-please-version
1120
+ version: "0.0.1-next.25", // x-release-please-version
1114
1121
  icon: "⚙️ ",
1115
1122
  supportsEnvFiles: false,
1116
1123
  overrideOutputWidth: options?.overrideOutputWidth
@@ -695,6 +695,8 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
695
695
  json = json.replace(/#\/components\/schemas\/(.*)\[\]/g, "#/components/schemas/ListOf$1");
696
696
  // Remove the partial markers
697
697
  json = json.replace(/Partial%3CI(.*?)%3E/g, "$1");
698
+ // Remove the omit markers
699
+ json = json.replace(/Omit%3CI(.*?)%2C.*%3E/g, "$1");
698
700
  // Cleanup the generic markers
699
701
  json = json.replace(/%3Cunknown%3E/g, "");
700
702
  // Remove external references
@@ -852,6 +854,8 @@ async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
852
854
  for (const def in schema.definitions) {
853
855
  // Remove the partial markers
854
856
  let defSub = def.replace(/^Partial<(.*?)>/g, "$1");
857
+ // Remove the omit markers
858
+ defSub = defSub.replace(/^Omit<(.*?),.*>/g, "$1");
855
859
  // Cleanup the generic markers
856
860
  defSub = defSub.replace(/</g, "%3C").replace(/>/g, "%3E");
857
861
  allSchemas[defSub] = schema.definitions[def];
@@ -895,7 +899,10 @@ function extractTypes(allSchemas, requiredTypes, referencedSchemas) {
895
899
  function extractTypesFromSchema(allTypes, schema, output) {
896
900
  const additionalTypes = [];
897
901
  if (Is.stringValue(schema.$ref)) {
898
- additionalTypes.push(schema.$ref.replace("#/definitions/", "").replace(/^Partial%3C(.*?)%3E/g, "$1"));
902
+ additionalTypes.push(schema.$ref
903
+ .replace("#/definitions/", "")
904
+ .replace(/^Partial%3C(.*?)%3E/g, "$1")
905
+ .replace(/^Omit%3C(.*?)%2C.*%3E/g, "$1"));
899
906
  }
900
907
  else if (Is.object(schema.items)) {
901
908
  if (Is.arrayValue(schema.items)) {
@@ -1107,7 +1114,7 @@ class CLI extends CLIBase {
1107
1114
  return this.execute({
1108
1115
  title: "TWIN TypeScript To OpenAPI",
1109
1116
  appName: "ts-to-openapi",
1110
- version: "0.0.1-next.23", // x-release-please-version
1117
+ version: "0.0.1-next.25", // x-release-please-version
1111
1118
  icon: "⚙️ ",
1112
1119
  supportsEnvFiles: false,
1113
1120
  overrideOutputWidth: options?.overrideOutputWidth
@@ -70,6 +70,8 @@
70
70
  "array": "Property \"{property}\" must be an array, it is \"{value}\"",
71
71
  "arrayValue": "Property \"{property}\" must be an array with at least one item",
72
72
  "arrayOneOf": "Property \"{property}\" must be one of [{options}], it is \"{value}\"",
73
+ "arrayStartsWith": "Property \"{property}\" must be an array starting with [{startValues}], it is \"{value}\"",
74
+ "arrayEndsWith": "Property \"{property}\" must be an array ending with [{endValues}], it is \"{value}\"",
73
75
  "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
74
76
  "function": "Property \"{property}\" must be a function, it is \"{value}\"",
75
77
  "urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
@@ -0,0 +1,5 @@
1
+ import type { JsonSchemaDraft202012Object } from "@hyperjump/json-schema/draft-2020-12";
2
+ /**
3
+ * Default schema type.
4
+ */
5
+ export type IJsonSchema = JsonSchemaDraft202012Object;
@@ -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,4 +1,5 @@
1
- import type { JSONSchema7Type, JSONSchema7TypeName } from "json-schema";
1
+ import type { Json } from "@hyperjump/json-pointer";
2
+ import type { JsonSchemaType } from "@hyperjump/json-schema";
2
3
  import type { IOpenApiExample } from "./IOpenApiExample";
3
4
  import type { IOpenApiResponse } from "./IOpenApiResponse";
4
5
  /**
@@ -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?: JsonSchemaType | JsonSchemaType[];
31
+ enum?: Json[];
31
32
  $ref?: string;
32
33
  };
33
34
  style?: string;
package/docs/changelog.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @twin.org/ts-to-openapi - Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Features
7
+
8
+ * add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nameof bumped from 0.0.1-next.24 to 0.0.1-next.25
16
+ * devDependencies
17
+ * @twin.org/merge-locales bumped from 0.0.1-next.24 to 0.0.1-next.25
18
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.24 to 0.0.1-next.25
19
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.24 to 0.0.1-next.25
20
+
21
+ ## [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)
22
+
23
+
24
+ ### Features
25
+
26
+ * strip Omit types ([3a079f9](https://github.com/twinfoundation/tools/commit/3a079f9abe8127c5b44a2b9382babf2f19629d08))
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * The following workspace dependencies were updated
32
+ * dependencies
33
+ * @twin.org/nameof bumped from 0.0.1-next.23 to 0.0.1-next.24
34
+ * devDependencies
35
+ * @twin.org/merge-locales bumped from 0.0.1-next.23 to 0.0.1-next.24
36
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.23 to 0.0.1-next.24
37
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.23 to 0.0.1-next.24
38
+
3
39
  ## [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)
4
40
 
5
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/ts-to-openapi",
3
- "version": "0.0.1-next.23",
3
+ "version": "0.0.1-next.25",
4
4
  "description": "Tool to convert TypeScript REST route definitions to OpenAPI Specifications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,14 +14,15 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
+ "@hyperjump/json-pointer": "1.1.1",
18
+ "@hyperjump/json-schema": "1.14.1",
17
19
  "@twin.org/api-models": "next",
18
20
  "@twin.org/cli-core": "next",
19
21
  "@twin.org/core": "next",
20
- "@twin.org/nameof": "0.0.1-next.23",
22
+ "@twin.org/nameof": "0.0.1-next.25",
21
23
  "@twin.org/web": "next",
22
- "commander": "13.1.0",
23
- "glob": "11.0.1",
24
- "jsonschema": "1.5.0",
24
+ "commander": "14.0.0",
25
+ "glob": "11.0.2",
25
26
  "ts-json-schema-generator": "2.4.0"
26
27
  },
27
28
  "main": "./dist/cjs/index.cjs",