1
- import { HttpClient } from './HttpClient' ;
2
- import { Indent } from './Indent' ;
3
1
import { parse as parseV2 } from './openApi/v2' ;
4
2
import { parse as parseV3 } from './openApi/v3' ;
5
3
import { getOpenApiSpec } from './utils/getOpenApiSpec' ;
6
4
import { getOpenApiVersion , OpenApiVersion } from './utils/getOpenApiVersion' ;
7
- import { isDefined } from './utils/isDefined' ;
8
5
import { isString } from './utils/isString' ;
9
6
import { postProcessClient } from './utils/postProcessClient' ;
10
7
import { registerHandlebarTemplates } from './utils/registerHandlebarTemplates' ;
11
8
import { writeClient } from './utils/writeClient' ;
12
9
13
- export { HttpClient } from './HttpClient' ;
14
- export { Indent } from './Indent' ;
15
-
16
10
export type Options = {
17
11
input : string | Record < string , any > ;
18
12
output : string ;
19
- httpClient ?: HttpClient ;
20
13
clientName ?: string ;
21
14
useOptions ?: boolean ;
22
15
useUnionTypes ?: boolean ;
23
16
exportCore ?: boolean ;
24
17
exportServices ?: boolean ;
25
18
exportModels ?: boolean ;
26
19
exportSchemas ?: boolean ;
27
- indent ?: Indent ;
28
20
postfix ?: string ;
29
21
request ?: string ;
30
22
write ?: boolean ;
@@ -36,43 +28,34 @@ export type Options = {
36
28
* service layer, etc.
37
29
* @param input The relative ___location of the OpenAPI spec
38
30
* @param output The relative ___location of the output directory
39
- * @param httpClient The selected httpClient (fetch, xhr, node or axios)
40
31
* @param clientName Custom client class name
41
32
* @param useOptions Use options or arguments functions
42
33
* @param useUnionTypes Use union types instead of enums
43
34
* @param exportCore Generate core client classes
44
35
* @param exportServices Generate services
45
36
* @param exportModels Generate models
46
37
* @param exportSchemas Generate schemas
47
- * @param indent Indentation options (4, 2 or tab)
48
38
* @param postfix Service name postfix
49
39
* @param request Path to custom request file
50
40
* @param write Write the files to disk (true or false)
51
41
*/
52
42
export const generate = async ( {
53
43
input,
54
44
output,
55
- httpClient = HttpClient . FETCH ,
56
45
clientName,
57
46
useOptions = false ,
58
47
useUnionTypes = false ,
59
48
exportCore = true ,
60
49
exportServices = true ,
61
50
exportModels = true ,
62
51
exportSchemas = false ,
63
- indent = Indent . SPACE_4 ,
64
52
postfix = 'Service' ,
65
53
request,
66
54
write = true ,
67
55
} : Options ) : Promise < void > => {
68
- if ( httpClient === HttpClient . ANGULAR && isDefined ( clientName ) ) {
69
- throw new Error ( 'Angular client does not support --name property' ) ;
70
- }
71
-
72
56
const openApi = isString ( input ) ? await getOpenApiSpec ( input ) : input ;
73
57
const openApiVersion = getOpenApiVersion ( openApi ) ;
74
58
const templates = registerHandlebarTemplates ( {
75
- httpClient,
76
59
useUnionTypes,
77
60
useOptions,
78
61
} ) ;
@@ -86,14 +69,12 @@ export const generate = async ({
86
69
clientFinal ,
87
70
templates ,
88
71
output ,
89
- httpClient ,
90
72
useOptions ,
91
73
useUnionTypes ,
92
74
exportCore ,
93
75
exportServices ,
94
76
exportModels ,
95
77
exportSchemas ,
96
- indent ,
97
78
postfix ,
98
79
clientName ,
99
80
request
@@ -109,14 +90,12 @@ export const generate = async ({
109
90
clientFinal ,
110
91
templates ,
111
92
output ,
112
- httpClient ,
113
93
useOptions ,
114
94
useUnionTypes ,
115
95
exportCore ,
116
96
exportServices ,
117
97
exportModels ,
118
98
exportSchemas ,
119
- indent ,
120
99
postfix ,
121
100
clientName ,
122
101
request
@@ -126,7 +105,4 @@ export const generate = async ({
126
105
}
127
106
} ;
128
107
129
- export default {
130
- HttpClient,
131
- generate,
132
- } ;
108
+ export default { generate } ;
0 commit comments