File tree Expand file tree Collapse file tree 3 files changed +1
-55
lines changed Expand file tree Collapse file tree 3 files changed +1
-55
lines changed Original file line number Diff line number Diff line change 66
66
"commander" : " ^8.0.0" ,
67
67
"form-data" : " ^4.0.0" ,
68
68
"handlebars" : " ^4.7.6" ,
69
- "js-yaml" : " ^4.0.0" ,
70
69
"json-schema-ref-parser" : " ^9.0.7" ,
71
70
"mkdirp" : " ^1.0.4" ,
72
71
"node-fetch" : " ^2.6.5" ,
82
81
"@types/express" : " 4.17.13" ,
83
82
"@types/glob" : " 7.1.4" ,
84
83
"@types/jest" : " 27.0.2" ,
85
- "@types/js-yaml" : " 4.0.3" ,
86
84
"@types/node" : " 16.10.3" ,
87
85
"@types/qs" : " 6.9.7" ,
88
86
"@typescript-eslint/eslint-plugin" : " 4.33.0" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import { load } from 'js-yaml' ;
2
1
import RefParser from 'json-schema-ref-parser' ;
3
- import { extname } from 'path' ;
4
-
5
- import { readSpec } from './readSpec' ;
6
2
7
3
/**
8
4
* Load and parse te open api spec. If the file extension is ".yml" or ".yaml"
@@ -11,26 +7,5 @@ import { readSpec } from './readSpec';
11
7
* @param input
12
8
*/
13
9
export async function getOpenApiSpec ( input : string ) : Promise < any > {
14
- const extension = extname ( input ) . toLowerCase ( ) ;
15
- const content = await readSpec ( input ) ;
16
- let rootObject : any ;
17
- switch ( extension ) {
18
- case '.yml' :
19
- case '.yaml' :
20
- try {
21
- rootObject = load ( content ) ;
22
- } catch ( e ) {
23
- throw new Error ( `Could not parse OpenApi YAML: "${ input } "` ) ;
24
- }
25
- break ;
26
-
27
- default :
28
- try {
29
- rootObject = JSON . parse ( content ) ;
30
- } catch ( e ) {
31
- throw new Error ( `Could not parse OpenApi JSON: "${ input } "` ) ;
32
- }
33
- break ;
34
- }
35
- return await RefParser . bundle ( rootObject ) ;
10
+ return await RefParser . bundle ( input ) ;
36
11
}
You can’t perform that action at this time.
0 commit comments