@twin.org/ts-to-openapi 0.0.1 → 0.0.2-next.2
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/dist/cjs/index.cjs +26 -149
- package/dist/esm/index.mjs +27 -150
- package/dist/locales/en.json +1 -0
- package/dist/types/models/ITsToOpenApiConfig.d.ts +11 -0
- package/docs/changelog.md +41 -0
- package/docs/reference/interfaces/ITsToOpenApiConfig.md +20 -0
- package/locales/en.json +1 -0
- package/package.json +8 -8
- package/dist/types/models/IJsonSchema.d.ts +0 -5
- package/dist/types/models/IOpenApi.d.ts +0 -54
- package/dist/types/models/IOpenApiExample.d.ts +0 -13
- package/dist/types/models/IOpenApiHeader.d.ts +0 -19
- package/dist/types/models/IOpenApiPathMethod.d.ts +0 -65
- package/dist/types/models/IOpenApiResponse.d.ts +0 -32
- package/dist/types/models/IOpenApiSecurityScheme.d.ts +0 -25
- package/dist/types/models/IPackageJson.d.ts +0 -15
- package/dist/types/models/jsonTypeName.d.ts +0 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ var node_url = require('node:url');
|
|
|
5
5
|
var cliCore = require('@twin.org/cli-core');
|
|
6
6
|
var promises = require('node:fs/promises');
|
|
7
7
|
var core = require('@twin.org/core');
|
|
8
|
+
var toolsCore = require('@twin.org/tools-core');
|
|
8
9
|
var web = require('@twin.org/web');
|
|
9
10
|
var tsJsonSchemaGenerator = require('ts-json-schema-generator');
|
|
10
11
|
|
|
@@ -195,7 +196,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
|
|
|
195
196
|
compilerOptions: {}
|
|
196
197
|
}, undefined, "\t"));
|
|
197
198
|
const openApi = {
|
|
198
|
-
openapi:
|
|
199
|
+
openapi: toolsCore.OpenApiHelper.API_VERSION,
|
|
199
200
|
info: {
|
|
200
201
|
title: config.title,
|
|
201
202
|
description: config.description,
|
|
@@ -239,7 +240,20 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.ts-to-openapi.progress.generatingSchemas"));
|
|
242
|
-
const
|
|
243
|
+
const autoExpandTypes = config.autoExpandTypes ?? [];
|
|
244
|
+
const defaultExpandTypes = ["/ObjectOrArray<.*>/"];
|
|
245
|
+
for (const defaultType of defaultExpandTypes) {
|
|
246
|
+
if (!autoExpandTypes.includes(defaultType)) {
|
|
247
|
+
autoExpandTypes.push(defaultType);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const schemas = await generateSchemas(typeRoots, types, autoExpandTypes, workingDirectory);
|
|
251
|
+
for (const type in schemas) {
|
|
252
|
+
if (core.Is.object(config.overrides?.[type])) {
|
|
253
|
+
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.ts-to-openapi.progress.overridingSchema"));
|
|
254
|
+
schemas[type] = config.overrides?.[type];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
243
257
|
const usedCommonResponseTypes = [];
|
|
244
258
|
for (let i = 0; i < inputResults.length; i++) {
|
|
245
259
|
const result = inputResults[i];
|
|
@@ -665,7 +679,7 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
|
|
|
665
679
|
delete finalSchemas[type];
|
|
666
680
|
}
|
|
667
681
|
for (const type in finalSchemas) {
|
|
668
|
-
processArrays(finalSchemas[type]);
|
|
682
|
+
toolsCore.JsonSchemaHelper.processArrays(finalSchemas[type]);
|
|
669
683
|
}
|
|
670
684
|
const schemaKeys = Object.keys(finalSchemas);
|
|
671
685
|
schemaKeys.sort();
|
|
@@ -698,7 +712,7 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
|
|
|
698
712
|
// Remove the array [] from the type names
|
|
699
713
|
// eslint-disable-next-line unicorn/better-regex
|
|
700
714
|
json = json.replace(/#\/components\/schemas\/(.*)\[\]/g, "#/components/schemas/ListOf$1");
|
|
701
|
-
json = normaliseTypeName(json);
|
|
715
|
+
json = toolsCore.JsonSchemaHelper.normaliseTypeName(json);
|
|
702
716
|
// Remove external references
|
|
703
717
|
for (const finalExternal in finalExternals) {
|
|
704
718
|
json = json.replace(new RegExp(`"#/components/schemas/${core.StringHelper.stripPrefix(finalExternal)}"`, "g"), `"${finalExternals[finalExternal]}"`);
|
|
@@ -828,7 +842,7 @@ async function processPackageRestDetails(restRoutes) {
|
|
|
828
842
|
* @returns Nothing.
|
|
829
843
|
* @internal
|
|
830
844
|
*/
|
|
831
|
-
async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
|
|
845
|
+
async function generateSchemas(modelDirWildcards, types, autoExpandTypes, outputWorkingDir) {
|
|
832
846
|
const allSchemas = {};
|
|
833
847
|
const arraySingularTypes = [];
|
|
834
848
|
for (const type of types) {
|
|
@@ -852,13 +866,17 @@ async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
|
|
|
852
866
|
const schema = generator.createSchema("*");
|
|
853
867
|
if (schema.definitions) {
|
|
854
868
|
for (const def in schema.definitions) {
|
|
855
|
-
const defSub = normaliseTypeName(def);
|
|
869
|
+
const defSub = toolsCore.JsonSchemaHelper.normaliseTypeName(def);
|
|
856
870
|
allSchemas[defSub] = schema.definitions[def];
|
|
857
871
|
}
|
|
858
872
|
}
|
|
859
873
|
}
|
|
860
874
|
const referencedSchemas = {};
|
|
861
|
-
extractTypes(allSchemas,
|
|
875
|
+
toolsCore.JsonSchemaHelper.extractTypes(allSchemas, [
|
|
876
|
+
...types,
|
|
877
|
+
...autoExpandTypes.map(t => (t.startsWith("/") && t.endsWith("/") ? new RegExp(t) : t))
|
|
878
|
+
], referencedSchemas);
|
|
879
|
+
toolsCore.JsonSchemaHelper.expandTypes(referencedSchemas, autoExpandTypes);
|
|
862
880
|
for (const arraySingularType of arraySingularTypes) {
|
|
863
881
|
referencedSchemas[`${arraySingularType}[]`] = {
|
|
864
882
|
type: "array",
|
|
@@ -869,74 +887,6 @@ async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
|
|
|
869
887
|
}
|
|
870
888
|
return referencedSchemas;
|
|
871
889
|
}
|
|
872
|
-
/**
|
|
873
|
-
* Extract the required types from all the known schemas.
|
|
874
|
-
* @param allSchemas All the known schemas.
|
|
875
|
-
* @param requiredTypes The required types.
|
|
876
|
-
* @param referencedSchemas The references schemas.
|
|
877
|
-
* @internal
|
|
878
|
-
*/
|
|
879
|
-
function extractTypes(allSchemas, requiredTypes, referencedSchemas) {
|
|
880
|
-
for (const type of requiredTypes) {
|
|
881
|
-
if (allSchemas[type] && !referencedSchemas[type]) {
|
|
882
|
-
referencedSchemas[type] = allSchemas[type];
|
|
883
|
-
extractTypesFromSchema(allSchemas, allSchemas[type], referencedSchemas);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Extract type from properties definition.
|
|
889
|
-
* @param allTypes All the known types.
|
|
890
|
-
* @param schema The schema to extract from.
|
|
891
|
-
* @param output The output types.
|
|
892
|
-
* @internal
|
|
893
|
-
*/
|
|
894
|
-
function extractTypesFromSchema(allTypes, schema, output) {
|
|
895
|
-
const additionalTypes = [];
|
|
896
|
-
if (core.Is.stringValue(schema.$ref)) {
|
|
897
|
-
additionalTypes.push(normaliseTypeName(schema.$ref).replace("#/definitions/", ""));
|
|
898
|
-
}
|
|
899
|
-
else if (core.Is.object(schema.items)) {
|
|
900
|
-
if (core.Is.arrayValue(schema.items)) {
|
|
901
|
-
for (const itemSchema of schema.items) {
|
|
902
|
-
extractTypesFromSchema(allTypes, itemSchema, output);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
else {
|
|
906
|
-
extractTypesFromSchema(allTypes, schema.items, output);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
else if (core.Is.object(schema.properties) || core.Is.object(schema.additionalProperties)) {
|
|
910
|
-
if (core.Is.object(schema.properties)) {
|
|
911
|
-
for (const prop in schema.properties) {
|
|
912
|
-
const p = schema.properties[prop];
|
|
913
|
-
if (core.Is.object(p)) {
|
|
914
|
-
extractTypesFromSchema(allTypes, p, output);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
if (core.Is.object(schema.additionalProperties)) {
|
|
919
|
-
extractTypesFromSchema(allTypes, schema.additionalProperties, output);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
else if (core.Is.arrayValue(schema.anyOf)) {
|
|
923
|
-
for (const prop of schema.anyOf) {
|
|
924
|
-
if (core.Is.object(prop)) {
|
|
925
|
-
extractTypesFromSchema(allTypes, prop, output);
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
else if (core.Is.arrayValue(schema.oneOf)) {
|
|
930
|
-
for (const prop of schema.oneOf) {
|
|
931
|
-
if (core.Is.object(prop)) {
|
|
932
|
-
extractTypesFromSchema(allTypes, prop, output);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
if (additionalTypes.length > 0) {
|
|
937
|
-
extractTypes(allTypes, additionalTypes, output);
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
890
|
/**
|
|
941
891
|
* Tidy up the schemas for use in OpenAPI context.
|
|
942
892
|
* @param props The properties to tidy up.
|
|
@@ -1087,79 +1037,6 @@ async function loadPackages(tsToOpenApiConfig, outputWorkingDir, typeRoots) {
|
|
|
1087
1037
|
}
|
|
1088
1038
|
return restRoutes;
|
|
1089
1039
|
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Process arrays in the schema object.
|
|
1092
|
-
* @param schemaObject The schema object to process.
|
|
1093
|
-
*/
|
|
1094
|
-
function processArrays(schemaObject) {
|
|
1095
|
-
if (core.Is.object(schemaObject)) {
|
|
1096
|
-
// latest specs have singular items in `items` property
|
|
1097
|
-
// and multiple items in prefixItems, so update the schema accordingly
|
|
1098
|
-
// https://www.learnjsonschema.com/2020-12/applicator/items/
|
|
1099
|
-
// https://www.learnjsonschema.com/2020-12/applicator/prefixitems/
|
|
1100
|
-
const schemaItems = schemaObject.items;
|
|
1101
|
-
if (core.Is.array(schemaItems) || core.Is.object(schemaItems)) {
|
|
1102
|
-
schemaObject.prefixItems = core.ArrayHelper.fromObjectOrArray(schemaItems);
|
|
1103
|
-
delete schemaObject.items;
|
|
1104
|
-
}
|
|
1105
|
-
const additionalItems = schemaObject.additionalItems;
|
|
1106
|
-
if (core.Is.array(additionalItems) || core.Is.object(additionalItems)) {
|
|
1107
|
-
schemaObject.items = core.ArrayHelper.fromObjectOrArray(additionalItems)[0];
|
|
1108
|
-
delete schemaObject.additionalItems;
|
|
1109
|
-
}
|
|
1110
|
-
processSchemaDictionary(schemaObject.properties);
|
|
1111
|
-
processArrays(schemaObject.additionalProperties);
|
|
1112
|
-
processSchemaArray(schemaObject.allOf);
|
|
1113
|
-
processSchemaArray(schemaObject.anyOf);
|
|
1114
|
-
processSchemaArray(schemaObject.oneOf);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* Process arrays in the schema object.
|
|
1119
|
-
* @param schemaDictionary The schema object to process.
|
|
1120
|
-
*/
|
|
1121
|
-
function processSchemaDictionary(schemaDictionary) {
|
|
1122
|
-
if (core.Is.object(schemaDictionary)) {
|
|
1123
|
-
for (const item of Object.values(schemaDictionary)) {
|
|
1124
|
-
if (core.Is.object(item)) {
|
|
1125
|
-
processArrays(item);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Process arrays in the schema object.
|
|
1132
|
-
* @param schemaArray The schema object to process.
|
|
1133
|
-
*/
|
|
1134
|
-
function processSchemaArray(schemaArray) {
|
|
1135
|
-
if (core.Is.arrayValue(schemaArray)) {
|
|
1136
|
-
for (const item of schemaArray) {
|
|
1137
|
-
if (core.Is.object(item)) {
|
|
1138
|
-
processArrays(item);
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
/**
|
|
1144
|
-
* Cleanup TypeScript markers from the type name.
|
|
1145
|
-
* @param typeName The definition string to clean up.
|
|
1146
|
-
* @returns The cleaned up definition string.
|
|
1147
|
-
*/
|
|
1148
|
-
function normaliseTypeName(typeName) {
|
|
1149
|
-
// Remove the partial markers
|
|
1150
|
-
let sTypeName = typeName.replace(/^Partial<(.*?)>/g, "$1");
|
|
1151
|
-
sTypeName = sTypeName.replace(/Partial%3CI(.*?)%3E/g, "$1");
|
|
1152
|
-
// Remove the omit markers
|
|
1153
|
-
sTypeName = sTypeName.replace(/^Omit<(.*?),.*>/g, "$1");
|
|
1154
|
-
sTypeName = sTypeName.replace(/Omit%3CI(.*?)%2C.*%3E/g, "$1");
|
|
1155
|
-
// Remove the pick markers
|
|
1156
|
-
sTypeName = sTypeName.replace(/^Pick<(.*?),.*>/g, "$1");
|
|
1157
|
-
sTypeName = sTypeName.replace(/Pick%3CI(.*?)%2C.*%3E/g, "$1");
|
|
1158
|
-
// Cleanup the generic markers
|
|
1159
|
-
sTypeName = sTypeName.replace(/</g, "%3C").replace(/>/g, "%3E");
|
|
1160
|
-
sTypeName = sTypeName.replace(/%3Cunknown%3E/g, "");
|
|
1161
|
-
return sTypeName;
|
|
1162
|
-
}
|
|
1163
1040
|
|
|
1164
1041
|
// Copyright 2024 IOTA Stiftung.
|
|
1165
1042
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -1179,7 +1056,7 @@ class CLI extends cliCore.CLIBase {
|
|
|
1179
1056
|
return this.execute({
|
|
1180
1057
|
title: "TWIN TypeScript To OpenAPI",
|
|
1181
1058
|
appName: "ts-to-openapi",
|
|
1182
|
-
version: "0.0.
|
|
1059
|
+
version: "0.0.2-next.2", // x-release-please-version
|
|
1183
1060
|
icon: "⚙️ ",
|
|
1184
1061
|
supportsEnvFiles: false,
|
|
1185
1062
|
overrideOutputWidth: options?.overrideOutputWidth
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,7 +2,8 @@ import path from 'node:path';
|
|
|
2
2
|
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
|
-
import { I18n, GeneralError, Is, StringHelper, ObjectHelper
|
|
5
|
+
import { I18n, GeneralError, Is, StringHelper, ObjectHelper } from '@twin.org/core';
|
|
6
|
+
import { OpenApiHelper, JsonSchemaHelper } from '@twin.org/tools-core';
|
|
6
7
|
import { HttpStatusCode, MimeTypes } from '@twin.org/web';
|
|
7
8
|
import { createGenerator } from 'ts-json-schema-generator';
|
|
8
9
|
|
|
@@ -192,7 +193,7 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
|
|
|
192
193
|
compilerOptions: {}
|
|
193
194
|
}, undefined, "\t"));
|
|
194
195
|
const openApi = {
|
|
195
|
-
openapi:
|
|
196
|
+
openapi: OpenApiHelper.API_VERSION,
|
|
196
197
|
info: {
|
|
197
198
|
title: config.title,
|
|
198
199
|
description: config.description,
|
|
@@ -236,7 +237,20 @@ async function tsToOpenApi(config, outputFile, workingDirectory) {
|
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
CLIDisplay.task(I18n.formatMessage("commands.ts-to-openapi.progress.generatingSchemas"));
|
|
239
|
-
const
|
|
240
|
+
const autoExpandTypes = config.autoExpandTypes ?? [];
|
|
241
|
+
const defaultExpandTypes = ["/ObjectOrArray<.*>/"];
|
|
242
|
+
for (const defaultType of defaultExpandTypes) {
|
|
243
|
+
if (!autoExpandTypes.includes(defaultType)) {
|
|
244
|
+
autoExpandTypes.push(defaultType);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const schemas = await generateSchemas(typeRoots, types, autoExpandTypes, workingDirectory);
|
|
248
|
+
for (const type in schemas) {
|
|
249
|
+
if (Is.object(config.overrides?.[type])) {
|
|
250
|
+
CLIDisplay.task(I18n.formatMessage("commands.ts-to-openapi.progress.overridingSchema"));
|
|
251
|
+
schemas[type] = config.overrides?.[type];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
240
254
|
const usedCommonResponseTypes = [];
|
|
241
255
|
for (let i = 0; i < inputResults.length; i++) {
|
|
242
256
|
const result = inputResults[i];
|
|
@@ -662,7 +676,7 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
|
|
|
662
676
|
delete finalSchemas[type];
|
|
663
677
|
}
|
|
664
678
|
for (const type in finalSchemas) {
|
|
665
|
-
processArrays(finalSchemas[type]);
|
|
679
|
+
JsonSchemaHelper.processArrays(finalSchemas[type]);
|
|
666
680
|
}
|
|
667
681
|
const schemaKeys = Object.keys(finalSchemas);
|
|
668
682
|
schemaKeys.sort();
|
|
@@ -695,7 +709,7 @@ async function finaliseOutput(usedCommonResponseTypes, schemas, openApi, securit
|
|
|
695
709
|
// Remove the array [] from the type names
|
|
696
710
|
// eslint-disable-next-line unicorn/better-regex
|
|
697
711
|
json = json.replace(/#\/components\/schemas\/(.*)\[\]/g, "#/components/schemas/ListOf$1");
|
|
698
|
-
json = normaliseTypeName(json);
|
|
712
|
+
json = JsonSchemaHelper.normaliseTypeName(json);
|
|
699
713
|
// Remove external references
|
|
700
714
|
for (const finalExternal in finalExternals) {
|
|
701
715
|
json = json.replace(new RegExp(`"#/components/schemas/${StringHelper.stripPrefix(finalExternal)}"`, "g"), `"${finalExternals[finalExternal]}"`);
|
|
@@ -825,7 +839,7 @@ async function processPackageRestDetails(restRoutes) {
|
|
|
825
839
|
* @returns Nothing.
|
|
826
840
|
* @internal
|
|
827
841
|
*/
|
|
828
|
-
async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
|
|
842
|
+
async function generateSchemas(modelDirWildcards, types, autoExpandTypes, outputWorkingDir) {
|
|
829
843
|
const allSchemas = {};
|
|
830
844
|
const arraySingularTypes = [];
|
|
831
845
|
for (const type of types) {
|
|
@@ -849,13 +863,17 @@ async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
|
|
|
849
863
|
const schema = generator.createSchema("*");
|
|
850
864
|
if (schema.definitions) {
|
|
851
865
|
for (const def in schema.definitions) {
|
|
852
|
-
const defSub = normaliseTypeName(def);
|
|
866
|
+
const defSub = JsonSchemaHelper.normaliseTypeName(def);
|
|
853
867
|
allSchemas[defSub] = schema.definitions[def];
|
|
854
868
|
}
|
|
855
869
|
}
|
|
856
870
|
}
|
|
857
871
|
const referencedSchemas = {};
|
|
858
|
-
extractTypes(allSchemas,
|
|
872
|
+
JsonSchemaHelper.extractTypes(allSchemas, [
|
|
873
|
+
...types,
|
|
874
|
+
...autoExpandTypes.map(t => (t.startsWith("/") && t.endsWith("/") ? new RegExp(t) : t))
|
|
875
|
+
], referencedSchemas);
|
|
876
|
+
JsonSchemaHelper.expandTypes(referencedSchemas, autoExpandTypes);
|
|
859
877
|
for (const arraySingularType of arraySingularTypes) {
|
|
860
878
|
referencedSchemas[`${arraySingularType}[]`] = {
|
|
861
879
|
type: "array",
|
|
@@ -866,74 +884,6 @@ async function generateSchemas(modelDirWildcards, types, outputWorkingDir) {
|
|
|
866
884
|
}
|
|
867
885
|
return referencedSchemas;
|
|
868
886
|
}
|
|
869
|
-
/**
|
|
870
|
-
* Extract the required types from all the known schemas.
|
|
871
|
-
* @param allSchemas All the known schemas.
|
|
872
|
-
* @param requiredTypes The required types.
|
|
873
|
-
* @param referencedSchemas The references schemas.
|
|
874
|
-
* @internal
|
|
875
|
-
*/
|
|
876
|
-
function extractTypes(allSchemas, requiredTypes, referencedSchemas) {
|
|
877
|
-
for (const type of requiredTypes) {
|
|
878
|
-
if (allSchemas[type] && !referencedSchemas[type]) {
|
|
879
|
-
referencedSchemas[type] = allSchemas[type];
|
|
880
|
-
extractTypesFromSchema(allSchemas, allSchemas[type], referencedSchemas);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* Extract type from properties definition.
|
|
886
|
-
* @param allTypes All the known types.
|
|
887
|
-
* @param schema The schema to extract from.
|
|
888
|
-
* @param output The output types.
|
|
889
|
-
* @internal
|
|
890
|
-
*/
|
|
891
|
-
function extractTypesFromSchema(allTypes, schema, output) {
|
|
892
|
-
const additionalTypes = [];
|
|
893
|
-
if (Is.stringValue(schema.$ref)) {
|
|
894
|
-
additionalTypes.push(normaliseTypeName(schema.$ref).replace("#/definitions/", ""));
|
|
895
|
-
}
|
|
896
|
-
else if (Is.object(schema.items)) {
|
|
897
|
-
if (Is.arrayValue(schema.items)) {
|
|
898
|
-
for (const itemSchema of schema.items) {
|
|
899
|
-
extractTypesFromSchema(allTypes, itemSchema, output);
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
else {
|
|
903
|
-
extractTypesFromSchema(allTypes, schema.items, output);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
else if (Is.object(schema.properties) || Is.object(schema.additionalProperties)) {
|
|
907
|
-
if (Is.object(schema.properties)) {
|
|
908
|
-
for (const prop in schema.properties) {
|
|
909
|
-
const p = schema.properties[prop];
|
|
910
|
-
if (Is.object(p)) {
|
|
911
|
-
extractTypesFromSchema(allTypes, p, output);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
if (Is.object(schema.additionalProperties)) {
|
|
916
|
-
extractTypesFromSchema(allTypes, schema.additionalProperties, output);
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
else if (Is.arrayValue(schema.anyOf)) {
|
|
920
|
-
for (const prop of schema.anyOf) {
|
|
921
|
-
if (Is.object(prop)) {
|
|
922
|
-
extractTypesFromSchema(allTypes, prop, output);
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
else if (Is.arrayValue(schema.oneOf)) {
|
|
927
|
-
for (const prop of schema.oneOf) {
|
|
928
|
-
if (Is.object(prop)) {
|
|
929
|
-
extractTypesFromSchema(allTypes, prop, output);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
if (additionalTypes.length > 0) {
|
|
934
|
-
extractTypes(allTypes, additionalTypes, output);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
887
|
/**
|
|
938
888
|
* Tidy up the schemas for use in OpenAPI context.
|
|
939
889
|
* @param props The properties to tidy up.
|
|
@@ -1084,79 +1034,6 @@ async function loadPackages(tsToOpenApiConfig, outputWorkingDir, typeRoots) {
|
|
|
1084
1034
|
}
|
|
1085
1035
|
return restRoutes;
|
|
1086
1036
|
}
|
|
1087
|
-
/**
|
|
1088
|
-
* Process arrays in the schema object.
|
|
1089
|
-
* @param schemaObject The schema object to process.
|
|
1090
|
-
*/
|
|
1091
|
-
function processArrays(schemaObject) {
|
|
1092
|
-
if (Is.object(schemaObject)) {
|
|
1093
|
-
// latest specs have singular items in `items` property
|
|
1094
|
-
// and multiple items in prefixItems, so update the schema accordingly
|
|
1095
|
-
// https://www.learnjsonschema.com/2020-12/applicator/items/
|
|
1096
|
-
// https://www.learnjsonschema.com/2020-12/applicator/prefixitems/
|
|
1097
|
-
const schemaItems = schemaObject.items;
|
|
1098
|
-
if (Is.array(schemaItems) || Is.object(schemaItems)) {
|
|
1099
|
-
schemaObject.prefixItems = ArrayHelper.fromObjectOrArray(schemaItems);
|
|
1100
|
-
delete schemaObject.items;
|
|
1101
|
-
}
|
|
1102
|
-
const additionalItems = schemaObject.additionalItems;
|
|
1103
|
-
if (Is.array(additionalItems) || Is.object(additionalItems)) {
|
|
1104
|
-
schemaObject.items = ArrayHelper.fromObjectOrArray(additionalItems)[0];
|
|
1105
|
-
delete schemaObject.additionalItems;
|
|
1106
|
-
}
|
|
1107
|
-
processSchemaDictionary(schemaObject.properties);
|
|
1108
|
-
processArrays(schemaObject.additionalProperties);
|
|
1109
|
-
processSchemaArray(schemaObject.allOf);
|
|
1110
|
-
processSchemaArray(schemaObject.anyOf);
|
|
1111
|
-
processSchemaArray(schemaObject.oneOf);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Process arrays in the schema object.
|
|
1116
|
-
* @param schemaDictionary The schema object to process.
|
|
1117
|
-
*/
|
|
1118
|
-
function processSchemaDictionary(schemaDictionary) {
|
|
1119
|
-
if (Is.object(schemaDictionary)) {
|
|
1120
|
-
for (const item of Object.values(schemaDictionary)) {
|
|
1121
|
-
if (Is.object(item)) {
|
|
1122
|
-
processArrays(item);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Process arrays in the schema object.
|
|
1129
|
-
* @param schemaArray The schema object to process.
|
|
1130
|
-
*/
|
|
1131
|
-
function processSchemaArray(schemaArray) {
|
|
1132
|
-
if (Is.arrayValue(schemaArray)) {
|
|
1133
|
-
for (const item of schemaArray) {
|
|
1134
|
-
if (Is.object(item)) {
|
|
1135
|
-
processArrays(item);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
/**
|
|
1141
|
-
* Cleanup TypeScript markers from the type name.
|
|
1142
|
-
* @param typeName The definition string to clean up.
|
|
1143
|
-
* @returns The cleaned up definition string.
|
|
1144
|
-
*/
|
|
1145
|
-
function normaliseTypeName(typeName) {
|
|
1146
|
-
// Remove the partial markers
|
|
1147
|
-
let sTypeName = typeName.replace(/^Partial<(.*?)>/g, "$1");
|
|
1148
|
-
sTypeName = sTypeName.replace(/Partial%3CI(.*?)%3E/g, "$1");
|
|
1149
|
-
// Remove the omit markers
|
|
1150
|
-
sTypeName = sTypeName.replace(/^Omit<(.*?),.*>/g, "$1");
|
|
1151
|
-
sTypeName = sTypeName.replace(/Omit%3CI(.*?)%2C.*%3E/g, "$1");
|
|
1152
|
-
// Remove the pick markers
|
|
1153
|
-
sTypeName = sTypeName.replace(/^Pick<(.*?),.*>/g, "$1");
|
|
1154
|
-
sTypeName = sTypeName.replace(/Pick%3CI(.*?)%2C.*%3E/g, "$1");
|
|
1155
|
-
// Cleanup the generic markers
|
|
1156
|
-
sTypeName = sTypeName.replace(/</g, "%3C").replace(/>/g, "%3E");
|
|
1157
|
-
sTypeName = sTypeName.replace(/%3Cunknown%3E/g, "");
|
|
1158
|
-
return sTypeName;
|
|
1159
|
-
}
|
|
1160
1037
|
|
|
1161
1038
|
// Copyright 2024 IOTA Stiftung.
|
|
1162
1039
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -1176,7 +1053,7 @@ class CLI extends CLIBase {
|
|
|
1176
1053
|
return this.execute({
|
|
1177
1054
|
title: "TWIN TypeScript To OpenAPI",
|
|
1178
1055
|
appName: "ts-to-openapi",
|
|
1179
|
-
version: "0.0.
|
|
1056
|
+
version: "0.0.2-next.2", // x-release-please-version
|
|
1180
1057
|
icon: "⚙️ ",
|
|
1181
1058
|
supportsEnvFiles: false,
|
|
1182
1059
|
overrideOutputWidth: options?.overrideOutputWidth
|
package/dist/locales/en.json
CHANGED
|
@@ -284,6 +284,7 @@
|
|
|
284
284
|
"creatingWorkingDir": "Creating Working Directory",
|
|
285
285
|
"creatingSecuritySchemas": "Creating Security Schemas",
|
|
286
286
|
"generatingSchemas": "Generating Schemas",
|
|
287
|
+
"overridingSchema": "Overriding Schema",
|
|
287
288
|
"finalisingSchemas": "Finalising Schemas",
|
|
288
289
|
"writingOutputFile": "Writing Output File",
|
|
289
290
|
"models": "Models",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IJsonSchema } from "@twin.org/tools-core";
|
|
1
2
|
import type { ITsToOpenApiConfigEntryPoint } from "./ITsToOpenApiConfigEntryPoint";
|
|
2
3
|
/**
|
|
3
4
|
* Configuration for the API.
|
|
@@ -58,4 +59,14 @@ export interface ITsToOpenApiConfig {
|
|
|
58
59
|
externalReferences?: {
|
|
59
60
|
[id: string]: string;
|
|
60
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Override for specific types, to be used when the type cannot be generated automatically, or is generated incorrectly.
|
|
64
|
+
*/
|
|
65
|
+
overrides?: {
|
|
66
|
+
[id: string]: IJsonSchema;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The types to automatically expand inline in type definitions, reg ex string matches.
|
|
70
|
+
*/
|
|
71
|
+
autoExpandTypes?: string[];
|
|
61
72
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @twin.org/ts-to-openapi - Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve auto expand types ([6181d1d](https://github.com/twinfoundation/tools/commit/6181d1daded1f91323195cf7efbc2f1881f38b41))
|
|
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.1 to 0.0.2-next.2
|
|
16
|
+
|
|
17
|
+
## [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add latest json schema features ([494293f](https://github.com/twinfoundation/tools/commit/494293f4252b9c7d4a20790ec157fc9d8c96c3d2))
|
|
23
|
+
* add support for auto expand types ([dd1e10a](https://github.com/twinfoundation/tools/commit/dd1e10a5b2fea6f80890ff6f3971f48e239cb4c1))
|
|
24
|
+
* add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
|
|
25
|
+
* generate schemas as individual entities ([9f372ab](https://github.com/twinfoundation/tools/commit/9f372abdfc27aba93b303c7b214991919c0c18c3))
|
|
26
|
+
* improve schema type name normalisation ([1a18b26](https://github.com/twinfoundation/tools/commit/1a18b267d87e9179bda01b396b256c450ae2889e))
|
|
27
|
+
* move package to framework repo ([4490bda](https://github.com/twinfoundation/tools/commit/4490bda472d4dc8ddfe931e2fce81f3411de9ab3))
|
|
28
|
+
* strip Omit types ([3a079f9](https://github.com/twinfoundation/tools/commit/3a079f9abe8127c5b44a2b9382babf2f19629d08))
|
|
29
|
+
* use most recent JSON schema specs ([4598cbf](https://github.com/twinfoundation/tools/commit/4598cbf29f7b82dba4a9f3b19f81dfe66f5a6060))
|
|
30
|
+
* use shared store mechanism ([#31](https://github.com/twinfoundation/tools/issues/31)) ([d9fe68b](https://github.com/twinfoundation/tools/commit/d9fe68b903d1268c7cb3c64772df5cb78fd63667))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* fix locale resource name ([53ad5b5](https://github.com/twinfoundation/tools/commit/53ad5b56f19a5082f16a4f1e4a761e114dce8250))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Dependencies
|
|
39
|
+
|
|
40
|
+
* The following workspace dependencies were updated
|
|
41
|
+
* dependencies
|
|
42
|
+
* @twin.org/tools-core bumped from 0.0.2-next.0 to 0.0.2-next.1
|
|
43
|
+
|
|
3
44
|
## 0.0.1 (2025-07-03)
|
|
4
45
|
|
|
5
46
|
|
|
@@ -101,3 +101,23 @@ External type references
|
|
|
101
101
|
#### Index Signature
|
|
102
102
|
|
|
103
103
|
\[`id`: `string`\]: `string`
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
### overrides?
|
|
108
|
+
|
|
109
|
+
> `optional` **overrides**: `object`
|
|
110
|
+
|
|
111
|
+
Override for specific types, to be used when the type cannot be generated automatically, or is generated incorrectly.
|
|
112
|
+
|
|
113
|
+
#### Index Signature
|
|
114
|
+
|
|
115
|
+
\[`id`: `string`\]: `AnySchemaObject`
|
|
116
|
+
|
|
117
|
+
***
|
|
118
|
+
|
|
119
|
+
### autoExpandTypes?
|
|
120
|
+
|
|
121
|
+
> `optional` **autoExpandTypes**: `string`[]
|
|
122
|
+
|
|
123
|
+
The types to automatically expand inline in type definitions, reg ex string matches.
|
package/locales/en.json
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"creatingWorkingDir": "Creating Working Directory",
|
|
27
27
|
"creatingSecuritySchemas": "Creating Security Schemas",
|
|
28
28
|
"generatingSchemas": "Generating Schemas",
|
|
29
|
+
"overridingSchema": "Overriding Schema",
|
|
29
30
|
"finalisingSchemas": "Finalising Schemas",
|
|
30
31
|
"writingOutputFile": "Writing Output File",
|
|
31
32
|
"models": "Models",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/ts-to-openapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next.2",
|
|
4
4
|
"description": "Tool to convert TypeScript REST route definitions to OpenAPI Specifications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/api-models": "
|
|
18
|
-
"@twin.org/cli-core": "
|
|
19
|
-
"@twin.org/core": "
|
|
20
|
-
"@twin.org/nameof": "
|
|
21
|
-
"@twin.org/
|
|
22
|
-
"
|
|
17
|
+
"@twin.org/api-models": "next",
|
|
18
|
+
"@twin.org/cli-core": "next",
|
|
19
|
+
"@twin.org/core": "next",
|
|
20
|
+
"@twin.org/nameof": "next",
|
|
21
|
+
"@twin.org/tools-core": "0.0.2-next.2",
|
|
22
|
+
"@twin.org/web": "next",
|
|
23
23
|
"commander": "14.0.0",
|
|
24
|
-
"glob": "11.0.
|
|
24
|
+
"glob": "11.0.3",
|
|
25
25
|
"ts-json-schema-generator": "2.4.0"
|
|
26
26
|
},
|
|
27
27
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { IJsonSchema } from "./IJsonSchema";
|
|
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,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,65 +0,0 @@
|
|
|
1
|
-
import type { IJsonSchema } from "./IJsonSchema";
|
|
2
|
-
import type { IOpenApiExample } from "./IOpenApiExample";
|
|
3
|
-
import type { IOpenApiResponse } from "./IOpenApiResponse";
|
|
4
|
-
import type { JsonTypeName } from "./jsonTypeName";
|
|
5
|
-
/**
|
|
6
|
-
* The Open API config definition.
|
|
7
|
-
*/
|
|
8
|
-
export interface IOpenApiPathMethod {
|
|
9
|
-
/**
|
|
10
|
-
* The operation id.
|
|
11
|
-
*/
|
|
12
|
-
operationId: string;
|
|
13
|
-
/**
|
|
14
|
-
* Summary.
|
|
15
|
-
*/
|
|
16
|
-
summary: string;
|
|
17
|
-
/**
|
|
18
|
-
* Tags.
|
|
19
|
-
*/
|
|
20
|
-
tags?: string[];
|
|
21
|
-
/**
|
|
22
|
-
* Parameters.
|
|
23
|
-
*/
|
|
24
|
-
parameters?: {
|
|
25
|
-
name: string;
|
|
26
|
-
in: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
required: boolean;
|
|
29
|
-
schema: {
|
|
30
|
-
type?: JsonTypeName | JsonTypeName[];
|
|
31
|
-
enum?: IJsonSchema[];
|
|
32
|
-
$ref?: string;
|
|
33
|
-
};
|
|
34
|
-
style?: string;
|
|
35
|
-
}[];
|
|
36
|
-
/**
|
|
37
|
-
* Request body.
|
|
38
|
-
*/
|
|
39
|
-
requestBody?: {
|
|
40
|
-
required: boolean;
|
|
41
|
-
description?: string;
|
|
42
|
-
content?: {
|
|
43
|
-
[contentType: string]: {
|
|
44
|
-
schema: {
|
|
45
|
-
$ref: string;
|
|
46
|
-
};
|
|
47
|
-
examples?: {
|
|
48
|
-
[id: string]: IOpenApiExample;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Response body.
|
|
55
|
-
*/
|
|
56
|
-
responses?: {
|
|
57
|
-
[code: string]: IOpenApiResponse;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Security model for the API.
|
|
61
|
-
*/
|
|
62
|
-
security?: {
|
|
63
|
-
[name: string]: string[];
|
|
64
|
-
}[];
|
|
65
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for each individual package.
|
|
3
|
-
*/
|
|
4
|
-
export interface IPackageJson {
|
|
5
|
-
/**
|
|
6
|
-
* The name of the package.
|
|
7
|
-
*/
|
|
8
|
-
name: string;
|
|
9
|
-
/**
|
|
10
|
-
* The dependencies for the package.
|
|
11
|
-
*/
|
|
12
|
-
dependencies?: {
|
|
13
|
-
[id: string]: string;
|
|
14
|
-
};
|
|
15
|
-
}
|