From 4c040f31344b21005bd119cb9623f42973113066 Mon Sep 17 00:00:00 2001 From: vcua-mobify Date: Mon, 2 Jun 2025 09:40:48 -0700 Subject: [PATCH 1/2] Remove duplicate config file --- config.yaml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 config.yaml diff --git a/config.yaml b/config.yaml deleted file mode 100644 index 12aaeb1..0000000 --- a/config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -additionalProperties: - paramNaming: original \ No newline at end of file From 103df5d5f48673a3b9266b713fc508ecf69e6300 Mon Sep 17 00:00:00 2001 From: vcua-mobify Date: Mon, 2 Jun 2025 09:42:07 -0700 Subject: [PATCH 2/2] Add type to define the contents of exchange.json --- src/download/exchangeTypes.ts | 19 +++++++++++++++++++ src/download/index.ts | 2 +- src/generate/apiModel.ts | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/download/exchangeTypes.ts b/src/download/exchangeTypes.ts index d87b17b..23d3024 100644 --- a/src/download/exchangeTypes.ts +++ b/src/download/exchangeTypes.ts @@ -45,3 +45,22 @@ export type RawRestApi = Omit & { version: string; }[]; }; + +export type ExchangeConfig = { + dependencies?: { + version: string; + assetId: string; + groupId: string; + }[]; + version: string; + originalFormatVersion: string; + apiVersion: string; + descriptorVersion: string; + classifier: string; + main: string; + assetId: string; + groupId: string; + organizationId: string; + name: string; + tags: string[]; +}; diff --git a/src/download/index.ts b/src/download/index.ts index fb31909..156d8a9 100644 --- a/src/download/index.ts +++ b/src/download/index.ts @@ -9,4 +9,4 @@ export { extractFiles } from "./exchangeDirectoryParser"; export { groupByCategory, removeRamlLinks } from "./exchangeTools"; export { DownloadCommand } from "./downloadCommand"; export { getBearer } from "./bearerToken"; -export { RestApi } from "./exchangeTypes"; +export { RestApi, ExchangeConfig } from "./exchangeTypes"; diff --git a/src/generate/apiModel.ts b/src/generate/apiModel.ts index 17abc9c..7594049 100644 --- a/src/generate/apiModel.ts +++ b/src/generate/apiModel.ts @@ -13,7 +13,7 @@ import { } from "../common/amfParser"; import { Name } from "../common/structures/name"; -import { RestApi } from "../download/exchangeTypes"; +import { ExchangeConfig, RestApi } from "../download/exchangeTypes"; import path from "path"; import fs from "fs-extra"; import { ramlToolLogger } from "../common/logger"; @@ -56,7 +56,7 @@ export class ApiModel extends ApiMetadata { fs.lstatSync(filepath).isDirectory() && fs.existsSync(path.join(filepath, "exchange.json")) ) { - const exchangeConfig = fs.readJSONSync( + const exchangeConfig: ExchangeConfig = fs.readJSONSync( path.join(filepath, "exchange.json") );