Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cbcaec6

Browse files
snowe2010FalkWolsky
authored and
FalkWolsky
committed
Pull definition logic into a new function
1 parent 784951d commit cbcaec6

File tree

1 file changed

+3
-22
lines changed
  • server/node-service/src/plugins/openApi

1 file changed

+3
-22
lines changed

‎server/node-service/src/plugins/openApi/index.ts‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import {
1212
isFile,
1313
} from "./util";
1414
import { badRequest } from "../../common/error";
15+
import { safeJsonParse } from "../../common/util";
1516
import { OpenAPI, OpenAPIV2, OpenAPIV3 } from "openapi-types";
1617
import _ from "lodash";
1718
import { fetch } from "../../common/fetch";
18-
import { RequestInit } from "node-fetch";
19+
import { RequestInit,Response } from "node-fetch";
1920

2021
const dataSourceConfig = {
2122
type: "dataSource",
@@ -79,26 +80,6 @@ export async function runOpenApi(
7980
defaultHeaders?: Record<string, string>,
8081
openApiSpecDereferenced?: OpenAPI.Document,
8182
) {
82-
83-
const specList = Array.isArray(spec) ? spec : [{ spec, id: "" }];
84-
let definitions;
85-
86-
if (!openApiSpecDereferenced) {
87-
definitions = await Promise.all(
88-
specList.map(async ({id, spec}) => {
89-
const deRefedSpec = await SwaggerParser.dereference(spec);
90-
return {
91-
def: deRefedSpec,
92-
id,
93-
};
94-
})
95-
);
96-
} else {
97-
definitions = [{
98-
def: openApiSpecDereferenced,
99-
id: "",
100-
}]
101-
}
10283
const { actionName, ...otherActionData } = actionData;
10384
const { serverURL } = dataSourceConfig;
10485

@@ -220,4 +201,4 @@ const openApiPlugin: DataSourcePlugin<ActionDataType, DataSourceDataType> = {
220201
},
221202
};
222203

223-
export default openApiPlugin;
204+
export default openApiPlugin;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /