Skip to content

Commit ceeec59

Browse files
author
Thomasr
committed
Add openai spec version
1 parent 10d5859 commit ceeec59

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

server/node-service/src/plugins/openAi/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { parseOpenApi, ParseOpenApiOptions } from "../openApi/parse";
99
const spec = readYaml(path.join(__dirname, "./openAi.yaml"));
1010
const specs = {
1111
"v1.0": spec,
12-
"v2.0": spec,
1312
}
1413

1514
const dataSourceConfig = {
@@ -49,8 +48,8 @@ const openAiPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
4948
icon: "openAI.svg",
5049
category: "api",
5150
dataSourceConfig,
52-
queryConfig: async () => {
53-
const { actions, categories } = await parseOpenApi(spec, parseOptions);
51+
queryConfig: async (data) => {
52+
const { actions, categories } = await parseOpenApi(specs[data.specVersion as keyof typeof specs], parseOptions);
5453
return {
5554
type: "query",
5655
label: "Action",
@@ -68,7 +67,7 @@ const openAiPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
6867
dynamicParamsConfig: dataSourceConfig,
6968
specVersion: dataSourceConfig.specVersion,
7069
};
71-
return runOpenApi(actionData, runApiDsConfig, spec as OpenAPIV3.Document);
70+
return runOpenApi(actionData, runApiDsConfig, specs[dataSourceConfig.specVersion as keyof typeof specs] as OpenAPIV3.Document);
7271
},
7372
};
7473

server/node-service/src/plugins/woocommerce/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import spec from "./woocommerce-spec.json";
88
import { specsToOptions } from "../../common/util";
99
const specs = {
1010
"v1.0": spec,
11-
"v2.0": spec,
1211
}
1312

1413
export function prepareServerUrl(url: string) {

0 commit comments

Comments
 (0)