@@ -12,10 +12,11 @@ import {
12
12
isFile ,
13
13
} from "./util" ;
14
14
import { badRequest } from "../../common/error" ;
15
+ import { safeJsonParse } from "../../common/util" ;
15
16
import { OpenAPI , OpenAPIV2 , OpenAPIV3 } from "openapi-types" ;
16
17
import _ from "lodash" ;
17
18
import { fetch } from "../../common/fetch" ;
18
- import { RequestInit } from "node-fetch" ;
19
+ import { RequestInit , Response } from "node-fetch" ;
19
20
20
21
const dataSourceConfig = {
21
22
type : "dataSource" ,
@@ -79,26 +80,6 @@ export async function runOpenApi(
79
80
defaultHeaders ?: Record < string , string > ,
80
81
openApiSpecDereferenced ?: OpenAPI . Document ,
81
82
) {
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
- }
102
83
const { actionName, ...otherActionData } = actionData ;
103
84
const { serverURL } = dataSourceConfig ;
104
85
@@ -220,4 +201,4 @@ const openApiPlugin: DataSourcePlugin<ActionDataType, DataSourceDataType> = {
220
201
} ,
221
202
} ;
222
203
223
- export default openApiPlugin ;
204
+ export default openApiPlugin ;
0 commit comments