Skip to content

Commit 7059b79

Browse files
author
Thomasr
committed
Add couchdb spec version
1 parent f4a3592 commit 7059b79

File tree

1 file changed

+3
-4
lines changed
  • server/node-service/src/plugins/couchdb

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import spec from "./CouchDB-3.1.1-resolved.json";
77
import { specsToOptions } from "../../common/util";
88
const specs = {
99
"v1.0": spec,
10-
"v2.0": spec,
1110
}
1211
const dataSourceConfig = {
1312
type: "dataSource",
@@ -71,8 +70,8 @@ const couchdbPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
7170
icon: "couchdb.svg",
7271
category: "database",
7372
dataSourceConfig,
74-
queryConfig: async () => {
75-
const { actions, categories } = await parseOpenApi(spec as OpenAPI.Document, parseOptions);
73+
queryConfig: async (data) => {
74+
const { actions, categories } = await parseOpenApi(specs[data.specVersion as keyof typeof specs] as OpenAPI.Document, parseOptions);
7675
return {
7776
type: "query",
7877
label: "Operation",
@@ -91,7 +90,7 @@ const couchdbPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
9190
dynamicParamsConfig: otherDataSourceConfig,
9291
specVersion: dataSourceConfig.specVersion
9392
};
94-
return runOpenApi(actionData, runApiDsConfig, spec as OpenAPIV2.Document);
93+
return runOpenApi(actionData, runApiDsConfig, specs[dataSourceConfig.specVersion as keyof typeof specs] as OpenAPIV2.Document);
9594
},
9695
};
9796

0 commit comments

Comments
 (0)