@@ -15,23 +15,34 @@ const version = '3.0.x';
15
15
const outputDir = path . join ( __dirname , 'generated' , version ) ;
16
16
17
17
describe ( `OpenAPI ${ version } ` , ( ) => {
18
- const createConfig = ( userConfig : UserConfig ) : UserConfig => ( {
19
- plugins : [ '@hey-api/typescript' ] ,
20
- ...userConfig ,
21
- input : path . join (
18
+ const createConfig = ( userConfig : UserConfig ) : UserConfig => {
19
+ const inputPath = path . join (
22
20
__dirname ,
23
21
'spec' ,
24
22
version ,
25
- typeof userConfig . input === 'string' ? userConfig . input : '' ,
26
- ) ,
27
- logs : {
28
- level : 'silent' ,
29
- } ,
30
- output : path . join (
31
- outputDir ,
32
- typeof userConfig . output === 'string' ? userConfig . output : '' ,
33
- ) ,
34
- } ) ;
23
+ typeof userConfig . input === 'string'
24
+ ? userConfig . input
25
+ : ( userConfig . input . path as string ) ,
26
+ ) ;
27
+ return {
28
+ plugins : [ '@hey-api/typescript' ] ,
29
+ ...userConfig ,
30
+ input :
31
+ typeof userConfig . input === 'string'
32
+ ? inputPath
33
+ : {
34
+ ...userConfig . input ,
35
+ path : inputPath ,
36
+ } ,
37
+ logs : {
38
+ level : 'silent' ,
39
+ } ,
40
+ output : path . join (
41
+ outputDir ,
42
+ typeof userConfig . output === 'string' ? userConfig . output : '' ,
43
+ ) ,
44
+ } ;
45
+ } ;
35
46
36
47
const scenarios = [
37
48
{
@@ -388,6 +399,16 @@ describe(`OpenAPI ${version}`, () => {
388
399
} ) ,
389
400
description : 'handles null enums' ,
390
401
} ,
402
+ {
403
+ config : createConfig ( {
404
+ input : {
405
+ exclude : [ '@deprecated' ] ,
406
+ path : 'exclude-deprecated.yaml' ,
407
+ } ,
408
+ output : 'exclude-deprecated' ,
409
+ } ) ,
410
+ description : 'excludes deprecated fields' ,
411
+ } ,
391
412
{
392
413
config : createConfig ( {
393
414
input : 'internal-name-conflict.json' ,
0 commit comments