@@ -5,76 +5,76 @@ import schema from '../../../__fixtures__/openapi/swagger.json';
5
5
import { generateOpenApiClient } from '../src/openapi' ;
6
6
7
7
it ( 'swagger' , ( ) => {
8
- const options = getDefaultSchemaTSOptions ( {
9
- // include: [
10
- // '*.v1.*'
11
- // ],
12
- exclude : [
13
- '*.v1beta1.*' ,
14
- '*.v2beta1.*' ,
15
- 'io.k8s.api.events.v1.EventSeries' ,
16
- 'io.k8s.api.events.v1.Event' ,
17
- 'io.k8s.api.flowcontrol*'
18
- ]
19
- } )
20
- const code = generateOpenApiClient ( {
21
- ...options ,
22
- // version: 'v1',
23
- paths : {
24
- exclude : [
25
- '*flowschema*' ,
26
- '*v1beta1*' ,
27
- '*v2beta1*'
28
- ] ,
29
- excludeRequests : [
30
- 'head' ,
31
- 'options'
32
- ] ,
33
- excludeTags : [
34
- 'storage_v1beta1' ,
35
- '*v1beta1' ,
36
- '*v2beta1' ,
37
- '*v1beta1*' ,
38
- '*v2beta1*'
39
- ]
40
- } ,
41
- includeTypeComments : true ,
42
- includeMethodComments : true ,
43
- mergedParams : false ,
44
- namingStrategy : {
45
- useLastSegment : true ,
46
- renameMap : {
47
- 'io.k8s.api.discovery.v1.EndpointPort' : 'DiscoveryEndpointPort' ,
48
- 'io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ServiceReference' : 'ApiExtServiceReference' ,
49
- 'io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookClientConfig' : 'ApiExtWebhookClientConfig' ,
50
- 'io.k8s.api.admissionregistration.v1.ServiceReference' : 'AdmissionServiceReference'
51
- }
52
- }
53
- } , schema as any ) ;
54
- expect ( code ) . toMatchSnapshot ( ) ;
55
- writeFileSync ( __dirname + '/../../../__fixtures__/output/swagger-client.ts' , code ) ;
8
+ const options = getDefaultSchemaTSOptions ( {
9
+ // include: [
10
+ // '*.v1.*'
11
+ // ],
12
+ exclude : [
13
+ '*.v1beta1.*' ,
14
+ '*.v2beta1.*' ,
15
+ 'io.k8s.api.events.v1.EventSeries' ,
16
+ 'io.k8s.api.events.v1.Event' ,
17
+ 'io.k8s.api.flowcontrol*'
18
+ ]
19
+ } )
20
+ const code = generateOpenApiClient ( {
21
+ ...options ,
22
+ // version: 'v1',
23
+ paths : {
24
+ exclude : [
25
+ '*flowschema*' ,
26
+ '*v1beta1*' ,
27
+ '*v2beta1*'
28
+ ] ,
29
+ excludeRequests : [
30
+ 'head' ,
31
+ 'options'
32
+ ] ,
33
+ excludeTags : [
34
+ 'storage_v1beta1' ,
35
+ '*v1beta1' ,
36
+ '*v2beta1' ,
37
+ '*v1beta1*' ,
38
+ '*v2beta1*'
39
+ ]
40
+ } ,
41
+ includeTypeComments : true ,
42
+ includeMethodComments : true ,
43
+ mergedParams : false ,
44
+ namingStrategy : {
45
+ useLastSegment : true ,
46
+ renameMap : {
47
+ 'io.k8s.api.discovery.v1.EndpointPort' : 'DiscoveryEndpointPort' ,
48
+ 'io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ServiceReference' : 'ApiExtServiceReference' ,
49
+ 'io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookClientConfig' : 'ApiExtWebhookClientConfig' ,
50
+ 'io.k8s.api.admissionregistration.v1.ServiceReference' : 'AdmissionServiceReference'
51
+ }
52
+ }
53
+ } , schema as any ) ;
54
+ expect ( code ) . toMatchSnapshot ( ) ;
55
+ writeFileSync ( __dirname + '/../../../__fixtures__/output/swagger-client.ts' , code ) ;
56
56
} ) ;
57
57
58
58
it ( 'merged' , ( ) => {
59
- const options = getDefaultSchemaTSOptions ( {
60
- // include: [
61
- // '*.v1.*'
62
- // ],
63
- includeMethodComments : true ,
64
- namingStrategy : {
65
- useLastSegment : true
66
- }
67
- } )
68
- const code = generateOpenApiClient ( {
69
- ...options ,
70
- version : 'v1' ,
71
- mergedParams : true
72
- } , schema as any ) ;
73
- expect ( code ) . toMatchSnapshot ( ) ;
74
- writeFileSync ( __dirname + '/../../../__fixtures__/output/swagger-client.merged.ts' , code ) ;
59
+ const options = getDefaultSchemaTSOptions ( {
60
+ // include: [
61
+ // '*.v1.*'
62
+ // ],
63
+ includeMethodComments : true ,
64
+ namingStrategy : {
65
+ useLastSegment : true
66
+ }
67
+ } )
68
+ const code = generateOpenApiClient ( {
69
+ ...options ,
70
+ version : 'v1' ,
71
+ mergedParams : true
72
+ } , schema as any ) ;
73
+ expect ( code ) . toMatchSnapshot ( ) ;
74
+ writeFileSync ( __dirname + '/../../../__fixtures__/output/swagger-client.merged.ts' , code ) ;
75
75
} ) ;
76
76
77
77
it ( 'openapi' , ( ) => {
78
- const data = Object . keys ( schema . definitions )
79
- writeFileSync ( __dirname + '/../../../__fixtures__/output/swagger-definitions.json' , JSON . stringify ( data , null , 2 ) ) ;
78
+ const data = Object . keys ( schema . definitions )
79
+ writeFileSync ( __dirname + '/../../../__fixtures__/output/swagger-definitions.json' , JSON . stringify ( data , null , 2 ) ) ;
80
80
} ) ;
0 commit comments