@goast/kotlin 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/assets.d.ts +17 -0
- package/dist/src/assets.js +17 -0
- package/dist/src/ast/common.d.ts +4 -0
- package/dist/src/ast/node.d.ts +11 -0
- package/dist/src/ast/node.js +11 -0
- package/dist/src/ast/nodes/annotation.d.ts +44 -0
- package/dist/src/ast/nodes/annotation.js +40 -0
- package/dist/src/ast/nodes/argument.d.ts +33 -0
- package/dist/src/ast/nodes/argument.js +33 -0
- package/dist/src/ast/nodes/call.d.ts +42 -0
- package/dist/src/ast/nodes/call.js +42 -0
- package/dist/src/ast/nodes/class.d.ts +96 -0
- package/dist/src/ast/nodes/class.js +90 -0
- package/dist/src/ast/nodes/collection-literal.d.ts +35 -0
- package/dist/src/ast/nodes/collection-literal.js +35 -0
- package/dist/src/ast/nodes/constructor.d.ts +65 -0
- package/dist/src/ast/nodes/constructor.js +62 -0
- package/dist/src/ast/nodes/doc-tag.d.ts +41 -0
- package/dist/src/ast/nodes/doc-tag.js +41 -0
- package/dist/src/ast/nodes/doc.d.ts +44 -0
- package/dist/src/ast/nodes/doc.js +44 -0
- package/dist/src/ast/nodes/enum-value.d.ts +50 -0
- package/dist/src/ast/nodes/enum-value.js +47 -0
- package/dist/src/ast/nodes/enum.d.ts +67 -0
- package/dist/src/ast/nodes/enum.js +64 -0
- package/dist/src/ast/nodes/function.d.ts +105 -0
- package/dist/src/ast/nodes/function.js +105 -0
- package/dist/src/ast/nodes/generic-parameter.d.ts +37 -0
- package/dist/src/ast/nodes/generic-parameter.js +37 -0
- package/dist/src/ast/nodes/init-block.d.ts +32 -0
- package/dist/src/ast/nodes/init-block.js +32 -0
- package/dist/src/ast/nodes/interface.d.ts +73 -0
- package/dist/src/ast/nodes/interface.js +68 -0
- package/dist/src/ast/nodes/lambda-type.d.ts +42 -0
- package/dist/src/ast/nodes/lambda-type.js +42 -0
- package/dist/src/ast/nodes/lambda.d.ts +41 -0
- package/dist/src/ast/nodes/lambda.js +41 -0
- package/dist/src/ast/nodes/object.d.ts +66 -0
- package/dist/src/ast/nodes/object.js +62 -0
- package/dist/src/ast/nodes/parameter.d.ts +68 -0
- package/dist/src/ast/nodes/parameter.js +68 -0
- package/dist/src/ast/nodes/property.d.ts +152 -0
- package/dist/src/ast/nodes/property.js +148 -0
- package/dist/src/ast/nodes/reference.d.ts +107 -0
- package/dist/src/ast/nodes/reference.js +75 -0
- package/dist/src/ast/nodes/string.d.ts +57 -0
- package/dist/src/ast/nodes/string.js +57 -0
- package/dist/src/ast/nodes/types.d.ts +9 -0
- package/dist/src/ast/references/jackson.d.ts +67 -0
- package/dist/src/ast/references/jackson.js +59 -0
- package/dist/src/ast/references/jakarta.d.ts +13 -0
- package/dist/src/ast/references/jakarta.js +13 -0
- package/dist/src/ast/references/java.d.ts +19 -0
- package/dist/src/ast/references/java.js +19 -0
- package/dist/src/ast/references/kotlin.d.ts +28 -0
- package/dist/src/ast/references/kotlin.js +28 -0
- package/dist/src/ast/references/kotlinx.d.ts +8 -0
- package/dist/src/ast/references/kotlinx.js +8 -0
- package/dist/src/ast/references/okhttp3.d.ts +8 -0
- package/dist/src/ast/references/okhttp3.js +8 -0
- package/dist/src/ast/references/reactor.d.ts +8 -0
- package/dist/src/ast/references/reactor.js +8 -0
- package/dist/src/ast/references/spring-reactive.d.ts +18 -0
- package/dist/src/ast/references/spring-reactive.js +18 -0
- package/dist/src/ast/references/spring.d.ts +27 -0
- package/dist/src/ast/references/spring.js +27 -0
- package/dist/src/ast/references/swagger.d.ts +13 -0
- package/dist/src/ast/references/swagger.js +13 -0
- package/dist/src/ast/utils/get-kotlin-builder-options.d.ts +10 -0
- package/dist/src/ast/utils/get-kotlin-builder-options.js +10 -0
- package/dist/src/ast/utils/to-kt-node.d.ts +40 -0
- package/dist/src/ast/utils/write-kt-annotations.d.ts +13 -0
- package/dist/src/ast/utils/write-kt-annotations.js +13 -0
- package/dist/src/ast/utils/write-kt-arguments.d.ts +15 -0
- package/dist/src/ast/utils/write-kt-arguments.js +15 -0
- package/dist/src/ast/utils/write-kt-enum-values.d.ts +13 -0
- package/dist/src/ast/utils/write-kt-enum-values.js +13 -0
- package/dist/src/ast/utils/write-kt-generic-parameters.d.ts +10 -0
- package/dist/src/ast/utils/write-kt-generic-parameters.js +10 -0
- package/dist/src/ast/utils/write-kt-members.d.ts +16 -0
- package/dist/src/ast/utils/write-kt-members.js +16 -0
- package/dist/src/ast/utils/write-kt-node.d.ts +29 -0
- package/dist/src/ast/utils/write-kt-node.js +24 -0
- package/dist/src/ast/utils/write-kt-parameters.d.ts +13 -0
- package/dist/src/ast/utils/write-kt-parameters.js +13 -0
- package/dist/src/common-results.d.ts +9 -0
- package/dist/src/config.d.ts +72 -0
- package/dist/src/config.js +5 -0
- package/dist/src/file-builder.d.ts +91 -0
- package/dist/src/file-builder.js +81 -0
- package/dist/src/generators/file-generator.d.ts +12 -0
- package/dist/src/generators/file-generator.js +7 -0
- package/dist/src/generators/models/args.d.ts +233 -0
- package/dist/src/generators/models/model-generator.d.ts +25 -0
- package/dist/src/generators/models/model-generator.js +14 -0
- package/dist/src/generators/models/models-generator.d.ts +15 -0
- package/dist/src/generators/models/models-generator.js +15 -0
- package/dist/src/generators/models/models.d.ts +93 -2
- package/dist/src/generators/models/models.js +5 -0
- package/dist/src/generators/services/okhttp3-clients/args.d.ts +138 -0
- package/dist/src/generators/services/okhttp3-clients/models.d.ts +83 -0
- package/dist/src/generators/services/okhttp3-clients/models.js +5 -0
- package/dist/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +33 -0
- package/dist/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +20 -0
- package/dist/src/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts +21 -0
- package/dist/src/generators/services/okhttp3-clients/okhttp3-clients-generator.js +21 -0
- package/dist/src/generators/services/okhttp3-clients/refs.d.ts +25 -0
- package/dist/src/generators/services/okhttp3-clients/refs.js +7 -0
- package/dist/src/generators/services/spring-controllers/args.d.ts +169 -0
- package/dist/src/generators/services/spring-controllers/models.d.ts +120 -0
- package/dist/src/generators/services/spring-controllers/models.js +4 -0
- package/dist/src/generators/services/spring-controllers/refs.d.ts +9 -0
- package/dist/src/generators/services/spring-controllers/refs.js +9 -0
- package/dist/src/generators/services/spring-controllers/spring-controller-generator.d.ts +29 -0
- package/dist/src/generators/services/spring-controllers/spring-controller-generator.js +19 -0
- package/dist/src/generators/services/spring-controllers/spring-controllers-generator.d.ts +22 -0
- package/dist/src/generators/services/spring-controllers/spring-controllers-generator.js +22 -0
- package/dist/src/generators/services/spring-reactive-web-clients/args.d.ts +224 -0
- package/dist/src/generators/services/spring-reactive-web-clients/models.d.ts +86 -0
- package/dist/src/generators/services/spring-reactive-web-clients/models.js +4 -0
- package/dist/src/generators/services/spring-reactive-web-clients/refs.d.ts +7 -0
- package/dist/src/generators/services/spring-reactive-web-clients/refs.js +7 -0
- package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts +36 -0
- package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +25 -0
- package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts +20 -0
- package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.js +20 -0
- package/dist/src/import-collection.d.ts +64 -0
- package/dist/src/import-collection.js +46 -0
- package/dist/src/types.d.ts +4 -0
- package/dist/src/utils.d.ts +52 -0
- package/dist/src/utils.js +52 -0
- package/package.json +2 -2
|
@@ -1,114 +1,338 @@
|
|
|
1
1
|
import type { ApiEndpoint, ApiParameter, ApiSchema, SourceBuilder } from '@goast/core';
|
|
2
2
|
import type { kt } from '../../../ast/index.ts';
|
|
3
3
|
import type { ApiParameterWithMultipartInfo } from '../../../types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Empty arguments for `getClientFileContent`. The file content is derived from the generation context alone.
|
|
6
|
+
*/
|
|
4
7
|
export type GetClientFileContent = object;
|
|
8
|
+
/**
|
|
9
|
+
* Empty arguments for `getRequestsObject`, which builds the Kotlin `object` declaration from the service's endpoints.
|
|
10
|
+
*/
|
|
5
11
|
export type GetRequestsObject = object;
|
|
12
|
+
/**
|
|
13
|
+
* Arguments for `getEndpointMembers`, which returns the four functions generated for one endpoint. `endpoint` is the
|
|
14
|
+
* operation, and `parameters` are its query, path, header and request body parameters as collected by
|
|
15
|
+
* `getAllParameters`.
|
|
16
|
+
*/
|
|
6
17
|
export type GetEndpointMembers = {
|
|
7
18
|
endpoint: ApiEndpoint;
|
|
8
19
|
parameters: ApiParameterWithMultipartInfo[];
|
|
9
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Arguments for `getEndpointFunctionName`. `endpoint` is the operation whose `name` is cased with `functionNameCasing`
|
|
23
|
+
* to name the `suspend` function.
|
|
24
|
+
*/
|
|
10
25
|
export type GetEndpointFunctionName = {
|
|
11
26
|
endpoint: ApiEndpoint;
|
|
12
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Arguments for `getEndpointDeprecatedAnnotations`. `endpoint` is the operation whose `deprecated` flag decides whether
|
|
30
|
+
* its functions receive a `@Deprecated("")` annotation.
|
|
31
|
+
*/
|
|
13
32
|
export type GetEndpointDeprecatedAnnotations = {
|
|
14
33
|
endpoint: ApiEndpoint;
|
|
15
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Arguments for `getEndpointFunction`, which generates the `suspend` function that returns the awaited response body.
|
|
37
|
+
*/
|
|
16
38
|
export type GetEndpointFunction = {
|
|
39
|
+
/**
|
|
40
|
+
* The operation the `suspend` function is generated for.
|
|
41
|
+
*/
|
|
17
42
|
endpoint: ApiEndpoint;
|
|
43
|
+
/**
|
|
44
|
+
* The parameters of the function, in the order they appear in its Kotlin signature.
|
|
45
|
+
*/
|
|
18
46
|
parameters: ApiParameterWithMultipartInfo[];
|
|
47
|
+
/**
|
|
48
|
+
* The schema of the response body the function returns, or `undefined` when the operation has no response body.
|
|
49
|
+
*/
|
|
19
50
|
responseSchema: ApiSchema | undefined;
|
|
20
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Arguments for `getEndpointFunctionBody`, which generates the call chain of the `suspend` function.
|
|
54
|
+
*/
|
|
21
55
|
export type GetEndpointFunctionBody = {
|
|
56
|
+
/**
|
|
57
|
+
* The operation whose function body is generated.
|
|
58
|
+
*/
|
|
22
59
|
endpoint: ApiEndpoint;
|
|
60
|
+
/**
|
|
61
|
+
* The parameters the body forwards to the request builder function, in signature order.
|
|
62
|
+
*/
|
|
23
63
|
parameters: ApiParameterWithMultipartInfo[];
|
|
64
|
+
/**
|
|
65
|
+
* The response body schema. When present the body awaits it with `awaitBody` and returns it, otherwise it awaits
|
|
66
|
+
* `awaitBodilessEntity`.
|
|
67
|
+
*/
|
|
24
68
|
responseSchema: ApiSchema | undefined;
|
|
25
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Arguments for `getEndpointRequestFunctionName`. `endpoint` is the operation whose name, with the `Request` suffix
|
|
72
|
+
* added, names the request builder function.
|
|
73
|
+
*/
|
|
26
74
|
export type GetEndpointRequestFunctionName = {
|
|
27
75
|
endpoint: ApiEndpoint;
|
|
28
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Arguments for `getEndpointRequestFunction`, which generates the plain function that builds the
|
|
79
|
+
* `WebClient.RequestHeadersSpec` for one operation.
|
|
80
|
+
*/
|
|
29
81
|
export type GetEndpointRequestFunction = {
|
|
82
|
+
/**
|
|
83
|
+
* The operation whose request builder is generated.
|
|
84
|
+
*/
|
|
30
85
|
endpoint: ApiEndpoint;
|
|
86
|
+
/**
|
|
87
|
+
* The parameters of the request builder, in the order they appear in its Kotlin signature.
|
|
88
|
+
*/
|
|
31
89
|
parameters: ApiParameterWithMultipartInfo[];
|
|
90
|
+
/**
|
|
91
|
+
* The response body schema. When present the request builder sets an `Accept: application/json` header.
|
|
92
|
+
*/
|
|
32
93
|
responseSchema: ApiSchema | undefined;
|
|
33
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* Arguments for `getEndpointRequestFunctionBody`, which builds the chain of `WebClient` calls for one operation.
|
|
97
|
+
*/
|
|
34
98
|
export type GetEndpointRequestFunctionBody = {
|
|
99
|
+
/**
|
|
100
|
+
* The operation whose request chain is built.
|
|
101
|
+
*/
|
|
35
102
|
endpoint: ApiEndpoint;
|
|
103
|
+
/**
|
|
104
|
+
* The parameters that feed the URI, body, multipart and header calls of the chain.
|
|
105
|
+
*/
|
|
36
106
|
parameters: ApiParameterWithMultipartInfo[];
|
|
107
|
+
/**
|
|
108
|
+
* The response body schema. When present the chain adds `accept(MediaType.APPLICATION_JSON)`.
|
|
109
|
+
*/
|
|
37
110
|
responseSchema: ApiSchema | undefined;
|
|
38
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* Arguments for `getEndpointFunctionWithHandler`, which generates the overload of the `suspend` function that takes a
|
|
114
|
+
* `responseHandler` and returns its result.
|
|
115
|
+
*/
|
|
39
116
|
export type GetEndpointFunctionWithHandler = {
|
|
117
|
+
/**
|
|
118
|
+
* The operation the response handler overload is generated for.
|
|
119
|
+
*/
|
|
40
120
|
endpoint: ApiEndpoint;
|
|
121
|
+
/**
|
|
122
|
+
* The parameters of the overload, in signature order, before the `responseHandler` parameter.
|
|
123
|
+
*/
|
|
41
124
|
parameters: ApiParameterWithMultipartInfo[];
|
|
125
|
+
/**
|
|
126
|
+
* The response body schema. The overload does not use it, but it is part of the shared argument set.
|
|
127
|
+
*/
|
|
42
128
|
responseSchema: ApiSchema | undefined;
|
|
43
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Arguments for `getEndpointFunctionWithHandlerBody`, which forwards the call of the response handler overload to the
|
|
132
|
+
* request builder function.
|
|
133
|
+
*/
|
|
44
134
|
export type GetEndpointFunctionWithHandlerBody = {
|
|
135
|
+
/**
|
|
136
|
+
* The operation whose overload body is generated.
|
|
137
|
+
*/
|
|
45
138
|
endpoint: ApiEndpoint;
|
|
139
|
+
/**
|
|
140
|
+
* The parameters forwarded to the request builder function, in signature order.
|
|
141
|
+
*/
|
|
46
142
|
parameters: ApiParameterWithMultipartInfo[];
|
|
143
|
+
/**
|
|
144
|
+
* The response body schema. The body does not read it and forwards only the endpoint and the parameters.
|
|
145
|
+
*/
|
|
47
146
|
responseSchema: ApiSchema | undefined;
|
|
48
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Arguments for `getEndpointUriCall`, which builds the `uri(...)` call of a request builder function.
|
|
150
|
+
*/
|
|
49
151
|
export type GetEndpointUriCall = {
|
|
152
|
+
/**
|
|
153
|
+
* The operation whose URI call is generated.
|
|
154
|
+
*/
|
|
50
155
|
endpoint: ApiEndpoint;
|
|
156
|
+
/**
|
|
157
|
+
* The parameters passed to the `<endpoint>Uri` helper. Only used when `preserveUriTemplate` is `false`, in which
|
|
158
|
+
* case the expanded URI is built by the helper.
|
|
159
|
+
*/
|
|
51
160
|
parameters: ApiParameterWithMultipartInfo[];
|
|
52
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* Arguments for `getUriPathVariablesValue`. `endpoint` is the operation whose path parameters become a `mapOf` of URI
|
|
164
|
+
* variables, or nothing when it has no path parameters.
|
|
165
|
+
*/
|
|
53
166
|
export type GetUriPathVariablesValue = {
|
|
54
167
|
endpoint: ApiEndpoint;
|
|
55
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Arguments for `getUriQueryParameterCalls`. `endpoint` is the operation whose query parameters become `queryParam`
|
|
171
|
+
* calls, or nothing when it has no query parameters.
|
|
172
|
+
*/
|
|
56
173
|
export type GetUriQueryParameterCalls = {
|
|
57
174
|
endpoint: ApiEndpoint;
|
|
58
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Arguments for `getEndpointUriFunctionName`. `endpoint` is the operation whose name, with the `Uri` suffix
|
|
178
|
+
* added, names the URI helper function.
|
|
179
|
+
*/
|
|
59
180
|
export type GetEndpointUriFunctionName = {
|
|
60
181
|
endpoint: ApiEndpoint;
|
|
61
182
|
};
|
|
183
|
+
/**
|
|
184
|
+
* Arguments for `getEndpointUriFunction`, which generates the `<endpoint>Uri` helper that returns the expanded URI.
|
|
185
|
+
*/
|
|
62
186
|
export type GetEndpointUriFunction = {
|
|
187
|
+
/**
|
|
188
|
+
* The operation the URI helper is generated for.
|
|
189
|
+
*/
|
|
63
190
|
endpoint: ApiEndpoint;
|
|
191
|
+
/**
|
|
192
|
+
* The parameters of the helper, filtered to the path and query parameters.
|
|
193
|
+
*/
|
|
64
194
|
parameters: ApiParameterWithMultipartInfo[];
|
|
65
195
|
};
|
|
196
|
+
/**
|
|
197
|
+
* Arguments for `getEndpointUriFunctionBody`, which builds the `UriComponentsBuilder` chain of the URI helper.
|
|
198
|
+
*/
|
|
66
199
|
export type GetEndpointUriFunctionBody = {
|
|
200
|
+
/**
|
|
201
|
+
* The operation whose path and query parameters the URI helper expands.
|
|
202
|
+
*/
|
|
67
203
|
endpoint: ApiEndpoint;
|
|
204
|
+
/**
|
|
205
|
+
* Not read by the body, which takes the path and query parameters from the endpoint itself.
|
|
206
|
+
*/
|
|
68
207
|
parameters: ApiParameterWithMultipartInfo[];
|
|
69
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Arguments for `getParameterToString`, which returns the suffix that converts a parameter value to a string, such as
|
|
211
|
+
* `.toString()`, `.value` or `.joinToString(",")`.
|
|
212
|
+
*/
|
|
70
213
|
export type GetParameterToString = {
|
|
214
|
+
/**
|
|
215
|
+
* The operation the parameter belongs to.
|
|
216
|
+
*/
|
|
71
217
|
endpoint: ApiEndpoint;
|
|
218
|
+
/**
|
|
219
|
+
* The path, query or header parameter whose value is converted.
|
|
220
|
+
*/
|
|
72
221
|
parameter: ApiParameterWithMultipartInfo;
|
|
73
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* Empty arguments for a `getAdditionalClientMembers` hook. The default generator does not define this method, so the
|
|
225
|
+
* type exists only for subclasses that add it.
|
|
226
|
+
*/
|
|
74
227
|
export type GetAdditionalClientMembers = object;
|
|
228
|
+
/**
|
|
229
|
+
* Arguments for `getParameterType`, which returns the Kotlin type of a parameter. `endpoint` is the operation
|
|
230
|
+
* the parameter belongs to, and `parameter` is the one whose type is needed. File parts resolve to `ApiRequestFile`.
|
|
231
|
+
*/
|
|
75
232
|
export type GetParameterType = {
|
|
76
233
|
endpoint: ApiEndpoint;
|
|
77
234
|
parameter: ApiParameterWithMultipartInfo;
|
|
78
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* Arguments for a `getRequestBodyType` hook. `endpoint` is the operation whose request body type is wanted. The default
|
|
238
|
+
* generator does not define or call this method, so the type exists only for subclasses that add it.
|
|
239
|
+
*/
|
|
79
240
|
export type GetRequestBodyType = {
|
|
80
241
|
endpoint: ApiEndpoint;
|
|
81
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* Arguments for `getParameterDefaultValue`, which returns the default value expression of an optional parameter.
|
|
245
|
+
*/
|
|
82
246
|
export type GetParameterDefaultValue = {
|
|
247
|
+
/**
|
|
248
|
+
* The operation the parameter belongs to.
|
|
249
|
+
*/
|
|
83
250
|
endpoint: ApiEndpoint;
|
|
251
|
+
/**
|
|
252
|
+
* The parameter whose default value expression is needed. Required parameters have no default.
|
|
253
|
+
*/
|
|
84
254
|
parameter: ApiParameter;
|
|
85
255
|
};
|
|
256
|
+
/**
|
|
257
|
+
* Arguments for `getTypeUsage`, which returns the Kotlin type a schema is used as, with the nullability adjusted.
|
|
258
|
+
*
|
|
259
|
+
* @template TBuilder The type of the source builder the Kotlin type is written to.
|
|
260
|
+
*/
|
|
86
261
|
export type GetTypeUsage<TBuilder extends SourceBuilder> = {
|
|
262
|
+
/**
|
|
263
|
+
* The schema to map to a Kotlin type. An `undefined` schema uses the fallback.
|
|
264
|
+
*/
|
|
87
265
|
schema: ApiSchema | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* Overrides the nullability of the mapped type. When omitted the mapped type keeps its own nullability.
|
|
268
|
+
*/
|
|
88
269
|
nullable?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* The type used when the schema maps to no model type.
|
|
272
|
+
* @default kt.refs.any({ nullable }), i.e. `Any` with the given nullability
|
|
273
|
+
*/
|
|
89
274
|
fallback?: kt.Type<TBuilder>;
|
|
90
275
|
};
|
|
276
|
+
/**
|
|
277
|
+
* Empty arguments for `getPackageName`, which combines `packageName` and `packageSuffix` into the service's package.
|
|
278
|
+
*/
|
|
91
279
|
export type GetPackageName = object;
|
|
280
|
+
/**
|
|
281
|
+
* Arguments for `getResponseSchema`. `endpoint` is the operation whose first successful response (a 2xx or unspecified
|
|
282
|
+
* status) supplies the schema of the response body.
|
|
283
|
+
*/
|
|
92
284
|
export type GetResponseSchema = {
|
|
93
285
|
endpoint: ApiEndpoint;
|
|
94
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* Arguments for `getSchemaType`. `schema` is the schema whose Kotlin model reference is looked up in `kotlin.models`,
|
|
289
|
+
* or `undefined` when there is no schema.
|
|
290
|
+
*/
|
|
95
291
|
export type GetSchemaType = {
|
|
96
292
|
schema: ApiSchema | undefined;
|
|
97
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* Arguments for `getAllParameters`. `endpoint` is the operation whose query, path and header parameters are collected,
|
|
296
|
+
* together with its request body, or with the fields of a multipart request body.
|
|
297
|
+
*/
|
|
98
298
|
export type GetAllParameters = {
|
|
99
299
|
endpoint: ApiEndpoint;
|
|
100
300
|
};
|
|
301
|
+
/**
|
|
302
|
+
* Arguments for `getRequestBodyParamName`. `endpoint` is the operation whose request body parameter is named after its
|
|
303
|
+
* model type, or `body` when there is no model type or it is `Any`.
|
|
304
|
+
*/
|
|
101
305
|
export type GetRequestBodyParamName = {
|
|
102
306
|
endpoint: ApiEndpoint;
|
|
103
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Arguments for `getEndpointDocDescription`. `endpoint` is the operation whose description, and its source line when
|
|
310
|
+
* `includeSourceInDocs` is set, becomes the KDoc of its functions.
|
|
311
|
+
*/
|
|
104
312
|
export type GetEndpointDocDescription = {
|
|
105
313
|
endpoint: ApiEndpoint;
|
|
106
314
|
};
|
|
315
|
+
/**
|
|
316
|
+
* Empty arguments for `getBasePath`, which derives a base path from the service's first server URL. The default
|
|
317
|
+
* generator does not call it, so the base path it returns is not written into the generated code.
|
|
318
|
+
*/
|
|
107
319
|
export type GetBasePath = object;
|
|
320
|
+
/**
|
|
321
|
+
* Arguments for `getEndpointPath`. `endpoint` is the operation whose path, without its leading slashes and after
|
|
322
|
+
* `pathModifier`, becomes the URI template.
|
|
323
|
+
*/
|
|
108
324
|
export type GetEndpointPath = {
|
|
109
325
|
endpoint: ApiEndpoint;
|
|
110
326
|
};
|
|
327
|
+
/**
|
|
328
|
+
* Arguments for `getFilePath`. `packageName` is the package whose directory, under `outputDir`, receives the requests
|
|
329
|
+
* object file.
|
|
330
|
+
*/
|
|
111
331
|
export type GetFilePath = {
|
|
112
332
|
packageName: string;
|
|
113
333
|
};
|
|
334
|
+
/**
|
|
335
|
+
* Empty arguments for `getRequestsObjectName`, which names the requests object after the service, cased with
|
|
336
|
+
* `typeNameCasing`.
|
|
337
|
+
*/
|
|
114
338
|
export type GetRequestsObjectName = object;
|
|
@@ -3,15 +3,61 @@ import type { KotlinImport } from '../../../common-results.ts';
|
|
|
3
3
|
import { type KotlinGeneratorConfig } from '../../../config.ts';
|
|
4
4
|
import type { KotlinModelsGeneratorOutput } from '../../models/index.ts';
|
|
5
5
|
import type { getReferenceFactories } from './refs.ts';
|
|
6
|
+
/**
|
|
7
|
+
* The configuration of the `KotlinSpringReactiveWebClientsGenerator`. Extends the common Kotlin generator options
|
|
8
|
+
* (`outputDir`, the casing options, `globalImports` and so on) with the options below.
|
|
9
|
+
*
|
|
10
|
+
* `springBootVersion` is inherited but has no effect on this generator, because the generated WebFlux client
|
|
11
|
+
* references no Spring Boot version specific type.
|
|
12
|
+
*/
|
|
6
13
|
export type KotlinSpringReactiveWebClientsGeneratorConfig = KotlinGeneratorConfig & {
|
|
14
|
+
/**
|
|
15
|
+
* The base package name of the generated client files. Each service's requests object is placed in the package
|
|
16
|
+
* `packageName + packageSuffix`, and the default infrastructure package is derived from it.
|
|
17
|
+
* @default 'com.openapi.generated'
|
|
18
|
+
*/
|
|
7
19
|
packageName: string;
|
|
20
|
+
/**
|
|
21
|
+
* The suffix appended to `packageName`, including the leading `.`. Together they form the package of each service's
|
|
22
|
+
* requests object, which is written to the matching directory under `{outputDir}`. A function receives the service,
|
|
23
|
+
* so each service can get its own package.
|
|
24
|
+
* @default '.api.client'
|
|
25
|
+
*/
|
|
8
26
|
packageSuffix: string | ((service?: ApiService) => string);
|
|
27
|
+
/**
|
|
28
|
+
* The package of the shared `ApiRequestFile` helper, which clients import for file parameters. A string is used as
|
|
29
|
+
* written. An object is resolved by its `mode`:
|
|
30
|
+
* - `append-package-name`: `packageName` followed by `value`.
|
|
31
|
+
* - `append-full-package-name`: `packageName` and `packageSuffix` followed by `value`.
|
|
32
|
+
* - `replace`: `value` as written.
|
|
33
|
+
*
|
|
34
|
+
* The helper is written to `{outputDir}/{package path}/ApiRequestFile.kt`. With a function-valued `packageSuffix`,
|
|
35
|
+
* the `append-full-package-name` mode calls it without a service.
|
|
36
|
+
* @default { mode: 'append-full-package-name', value: '.infrastructure' }, which resolves to
|
|
37
|
+
* 'com.openapi.generated.api.client.infrastructure'.
|
|
38
|
+
*/
|
|
9
39
|
infrastructurePackageName: string | {
|
|
10
40
|
mode: 'append-package-name' | 'append-full-package-name' | 'replace';
|
|
11
41
|
value: string;
|
|
12
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Has no effect on this generator. The request URIs are relative to the `WebClient` the caller passes in, which
|
|
45
|
+
* supplies the base URL, so no base path is written into the generated Kotlin code.
|
|
46
|
+
* @default undefined
|
|
47
|
+
*/
|
|
13
48
|
basePath?: string | RegExp | ((basePath: string, service: ApiService) => string);
|
|
49
|
+
/**
|
|
50
|
+
* Rewrites each endpoint path before it is written into the URI template passed to `WebClient.uri` and into the
|
|
51
|
+
* `<endpoint>Uri` helper. A function receives the path without its leading slashes and the endpoint, and returns the
|
|
52
|
+
* new path. A `RegExp` replaces the path with its first match, or keeps the path when nothing matches.
|
|
53
|
+
* @default undefined
|
|
54
|
+
*/
|
|
14
55
|
pathModifier?: RegExp | ((path: string, endpoint: ApiEndpoint) => string);
|
|
56
|
+
/**
|
|
57
|
+
* Has no effect on this generator. Only the OkHttp3 client generator reads it, to configure the serializer it emits.
|
|
58
|
+
* This generator emits no serializer, so its output does not depend on this value.
|
|
59
|
+
* @default 'non-absent'
|
|
60
|
+
*/
|
|
15
61
|
serializerJsonInclude: 'always' | 'non-null' | 'non-absent' | 'non-default' | 'non-empty' | 'use-defaults';
|
|
16
62
|
/**
|
|
17
63
|
* Whether the generated request functions pass the URI template (e.g. `pets/{id}`) to `WebClient` instead of an
|
|
@@ -28,20 +74,60 @@ export type KotlinSpringReactiveWebClientsGeneratorConfig = KotlinGeneratorConfi
|
|
|
28
74
|
*/
|
|
29
75
|
preserveUriTemplate: boolean;
|
|
30
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* The default configuration of the `KotlinSpringReactiveWebClientsGenerator`. It is merged over the common Kotlin
|
|
79
|
+
* defaults from `defaultKotlinGeneratorConfig`.
|
|
80
|
+
*/
|
|
31
81
|
export declare const defaultKotlinSpringReactiveWebClientsGeneratorConfig: DefaultGenerationProviderConfig<KotlinSpringReactiveWebClientsGeneratorConfig>;
|
|
82
|
+
/**
|
|
83
|
+
* The input of the `KotlinSpringReactiveWebClientsGenerator`: the output of the `KotlinModelsGenerator`. Each parameter
|
|
84
|
+
* and response type is resolved through `kotlin.models`, so the models generator must run before this generator.
|
|
85
|
+
*/
|
|
32
86
|
export type KotlinSpringReactiveWebClientsGeneratorInput = KotlinModelsGeneratorOutput;
|
|
87
|
+
/**
|
|
88
|
+
* The output of the `KotlinSpringReactiveWebClientsGenerator`. It is published under the `kotlin` key, and its
|
|
89
|
+
* `clients` record lets later generators import the requests object of each service.
|
|
90
|
+
*/
|
|
33
91
|
export type KotlinSpringReactiveWebClientsGeneratorOutput = {
|
|
92
|
+
/**
|
|
93
|
+
* The Kotlin results of this generator.
|
|
94
|
+
*/
|
|
34
95
|
kotlin: {
|
|
96
|
+
/**
|
|
97
|
+
* The generated requests objects, keyed by service id.
|
|
98
|
+
*/
|
|
35
99
|
clients: {
|
|
36
100
|
[serviceId: string]: KotlinSpringReactiveWebClientGeneratorOutput;
|
|
37
101
|
};
|
|
38
102
|
};
|
|
39
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* The output of the `DefaultKotlinSpringReactiveWebClientGenerator` for one service: the name and package of the
|
|
106
|
+
* generated requests object, stored under `kotlin.clients` for the service's id.
|
|
107
|
+
*/
|
|
40
108
|
export type KotlinSpringReactiveWebClientGeneratorOutput = KotlinImport;
|
|
109
|
+
/**
|
|
110
|
+
* The context of the `KotlinSpringReactiveWebClientsGenerator`. It extends the services generation context with the
|
|
111
|
+
* resolved infrastructure package and the reference factories.
|
|
112
|
+
*/
|
|
41
113
|
export type KotlinSpringReactiveWebClientsGeneratorContext = OpenApiServicesGenerationProviderContext<KotlinSpringReactiveWebClientsGeneratorInput, KotlinSpringReactiveWebClientsGeneratorOutput, KotlinSpringReactiveWebClientsGeneratorConfig, KotlinSpringReactiveWebClientGeneratorOutput> & {
|
|
114
|
+
/**
|
|
115
|
+
* The resolved package of the shared `ApiRequestFile` helper, as computed from `infrastructurePackageName`.
|
|
116
|
+
*/
|
|
42
117
|
infrastructurePackageName: string;
|
|
118
|
+
/**
|
|
119
|
+
* The reference factories this generator uses. `apiRequestFile` references `ApiRequestFile` in the infrastructure
|
|
120
|
+
* package, so the generated code imports it automatically.
|
|
121
|
+
*/
|
|
43
122
|
refs: ReturnType<typeof getReferenceFactories>;
|
|
44
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* The context of the `DefaultKotlinSpringReactiveWebClientGenerator`: the services context plus the service to
|
|
126
|
+
* generate a requests object for.
|
|
127
|
+
*/
|
|
45
128
|
export type KotlinSpringReactiveWebClientGeneratorContext = KotlinSpringReactiveWebClientsGeneratorContext & {
|
|
129
|
+
/**
|
|
130
|
+
* The service whose endpoints are generated into one requests object.
|
|
131
|
+
*/
|
|
46
132
|
service: ApiService;
|
|
47
133
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { defaultKotlinGeneratorConfig } from '../../../config.js';
|
|
2
|
+
/**
|
|
3
|
+
* The default configuration of the `KotlinSpringReactiveWebClientsGenerator`. It is merged over the common Kotlin
|
|
4
|
+
* defaults from `defaultKotlinGeneratorConfig`.
|
|
5
|
+
*/
|
|
2
6
|
export const defaultKotlinSpringReactiveWebClientsGeneratorConfig = {
|
|
3
7
|
...defaultKotlinGeneratorConfig,
|
|
4
8
|
packageName: 'com.openapi.generated',
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { kt } from '../../../ast/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the reference factories used by the Spring WebFlux client generators.
|
|
4
|
+
*
|
|
5
|
+
* @param infrastructurePackageName The package the shared `ApiRequestFile` helper is written to and imported from.
|
|
6
|
+
* @returns The reference factories, with `apiRequestFile` referencing `ApiRequestFile` in that package.
|
|
7
|
+
* @see KotlinSpringReactiveWebClientsGeneratorConfig.infrastructurePackageName
|
|
8
|
+
*/
|
|
2
9
|
export declare function getReferenceFactories(infrastructurePackageName: string): {
|
|
3
10
|
apiRequestFile: kt.ReferenceFactory;
|
|
4
11
|
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { kt } from '../../../ast/index.js';
|
|
2
2
|
// See packages/kotlin/assets/client/spring-reactive-web-clients for reference
|
|
3
|
+
/**
|
|
4
|
+
* Creates the reference factories used by the Spring WebFlux client generators.
|
|
5
|
+
*
|
|
6
|
+
* @param infrastructurePackageName The package the shared `ApiRequestFile` helper is written to and imported from.
|
|
7
|
+
* @returns The reference factories, with `apiRequestFile` referencing `ApiRequestFile` in that package.
|
|
8
|
+
* @see KotlinSpringReactiveWebClientsGeneratorConfig.infrastructurePackageName
|
|
9
|
+
*/
|
|
3
10
|
export function getReferenceFactories(infrastructurePackageName) {
|
|
4
11
|
return {
|
|
5
12
|
// ApiRequestFile.kt
|
|
@@ -8,10 +8,46 @@ import type { KotlinSpringReactiveWebClientGeneratorContext, KotlinSpringReactiv
|
|
|
8
8
|
type Context = KotlinSpringReactiveWebClientGeneratorContext;
|
|
9
9
|
type Output = KotlinSpringReactiveWebClientGeneratorOutput;
|
|
10
10
|
type Builder = KotlinFileBuilder;
|
|
11
|
+
/**
|
|
12
|
+
* Generates the Spring WebFlux client for one service. Implement it to replace the default client of a service, or
|
|
13
|
+
* pass a custom implementation to the `KotlinSpringReactiveWebClientsGenerator`.
|
|
14
|
+
*
|
|
15
|
+
* @template TOutput The type of the output the generator returns. Defaults to the default service output type.
|
|
16
|
+
*/
|
|
11
17
|
export interface KotlinSpringReactiveWebClientGenerator<TOutput extends Output = Output> {
|
|
18
|
+
/**
|
|
19
|
+
* Generates the client for the service in `ctx.service`.
|
|
20
|
+
* @param ctx The context of the service to generate.
|
|
21
|
+
* @returns The output for the service, directly or as a promise.
|
|
22
|
+
*/
|
|
12
23
|
generate(ctx: Context): MaybePromise<TOutput>;
|
|
13
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The default generator of a Spring WebFlux client for one service. It writes a single Kotlin file,
|
|
27
|
+
* `{outputDir}/{package path}/{Name}.kt`, where the package is `packageName + packageSuffix` and `{Name}` is the
|
|
28
|
+
* service name followed by `_Requests`, cased with `typeNameCasing`.
|
|
29
|
+
*
|
|
30
|
+
* The file contains a Kotlin `object` with four functions per endpoint. Their names come from `functionNameCasing`,
|
|
31
|
+
* shown here with the default camel casing:
|
|
32
|
+
* - `<endpoint>`: a `suspend` extension function on `WebClient` that returns the response body as its model type, or
|
|
33
|
+
* `Unit` without a response body. It awaits the body with `awaitBody`, or with `awaitBodilessEntity` without one.
|
|
34
|
+
* - `<endpoint>`, overloaded with a `responseHandler` parameter: a `suspend` function `<T : Any>` that passes the
|
|
35
|
+
* `ClientResponse` to the handler through `awaitExchange` and returns the handler's result.
|
|
36
|
+
* - `<endpoint>Request`: a plain function that returns a `WebClient.RequestHeadersSpec<*>` for the request.
|
|
37
|
+
* - `<endpoint>Uri`: a function that returns the expanded URI `String`. Requests use it only when `preserveUriTemplate`
|
|
38
|
+
* is `false`.
|
|
39
|
+
*
|
|
40
|
+
* No `Mono` or `Flux` appears in the generated code: the functions suspend instead of returning reactive publishers.
|
|
41
|
+
* Deprecated operations annotate all four functions with `@Deprecated("")`.
|
|
42
|
+
*
|
|
43
|
+
* @see KotlinSpringReactiveWebClientsGenerator
|
|
44
|
+
*/
|
|
14
45
|
export declare class DefaultKotlinSpringReactiveWebClientGenerator extends KotlinFileGenerator<Context, Output> implements KotlinSpringReactiveWebClientGenerator {
|
|
46
|
+
/**
|
|
47
|
+
* Writes the requests object file of `ctx.service` and returns its name and package.
|
|
48
|
+
* @param ctx The context of the service to generate.
|
|
49
|
+
* @returns The `typeName` and `packageName` of the generated requests object, published under `kotlin.clients`.
|
|
50
|
+
*/
|
|
15
51
|
generate(ctx: Context): MaybePromise<Output>;
|
|
16
52
|
protected getClientFileContent(ctx: Context, args: Args.GetClientFileContent): AppendValueGroup<Builder>;
|
|
17
53
|
protected getRequestsObject(ctx: Context, args: Args.GetRequestsObject): kt.Object<Builder>;
|
|
@@ -3,7 +3,32 @@ import { kt } from '../../../ast/index.js';
|
|
|
3
3
|
import { KotlinFileBuilder } from '../../../file-builder.js';
|
|
4
4
|
import { getArrayItemStringEnumSchema, getSourceDocLine, getStringEnumSchema, modifyString } from '../../../utils.js';
|
|
5
5
|
import { KotlinFileGenerator } from '../../file-generator.js';
|
|
6
|
+
/**
|
|
7
|
+
* The default generator of a Spring WebFlux client for one service. It writes a single Kotlin file,
|
|
8
|
+
* `{outputDir}/{package path}/{Name}.kt`, where the package is `packageName + packageSuffix` and `{Name}` is the
|
|
9
|
+
* service name followed by `_Requests`, cased with `typeNameCasing`.
|
|
10
|
+
*
|
|
11
|
+
* The file contains a Kotlin `object` with four functions per endpoint. Their names come from `functionNameCasing`,
|
|
12
|
+
* shown here with the default camel casing:
|
|
13
|
+
* - `<endpoint>`: a `suspend` extension function on `WebClient` that returns the response body as its model type, or
|
|
14
|
+
* `Unit` without a response body. It awaits the body with `awaitBody`, or with `awaitBodilessEntity` without one.
|
|
15
|
+
* - `<endpoint>`, overloaded with a `responseHandler` parameter: a `suspend` function `<T : Any>` that passes the
|
|
16
|
+
* `ClientResponse` to the handler through `awaitExchange` and returns the handler's result.
|
|
17
|
+
* - `<endpoint>Request`: a plain function that returns a `WebClient.RequestHeadersSpec<*>` for the request.
|
|
18
|
+
* - `<endpoint>Uri`: a function that returns the expanded URI `String`. Requests use it only when `preserveUriTemplate`
|
|
19
|
+
* is `false`.
|
|
20
|
+
*
|
|
21
|
+
* No `Mono` or `Flux` appears in the generated code: the functions suspend instead of returning reactive publishers.
|
|
22
|
+
* Deprecated operations annotate all four functions with `@Deprecated("")`.
|
|
23
|
+
*
|
|
24
|
+
* @see KotlinSpringReactiveWebClientsGenerator
|
|
25
|
+
*/
|
|
6
26
|
export class DefaultKotlinSpringReactiveWebClientGenerator extends KotlinFileGenerator {
|
|
27
|
+
/**
|
|
28
|
+
* Writes the requests object file of `ctx.service` and returns its name and package.
|
|
29
|
+
* @param ctx The context of the service to generate.
|
|
30
|
+
* @returns The `typeName` and `packageName` of the generated requests object, published under `kotlin.clients`.
|
|
31
|
+
*/
|
|
7
32
|
generate(ctx) {
|
|
8
33
|
const typeName = this.getRequestsObjectName(ctx, {});
|
|
9
34
|
const packageName = this.getPackageName(ctx, {});
|
|
@@ -7,8 +7,28 @@ type Output = KotlinSpringReactiveWebClientsGeneratorOutput;
|
|
|
7
7
|
type Config = KotlinSpringReactiveWebClientsGeneratorConfig;
|
|
8
8
|
type ServiceOutput = KotlinSpringReactiveWebClientGeneratorOutput;
|
|
9
9
|
type Context = KotlinSpringReactiveWebClientsGeneratorContext;
|
|
10
|
+
/**
|
|
11
|
+
* Generates a Spring WebFlux `WebClient` based Kotlin client for each service.
|
|
12
|
+
*
|
|
13
|
+
* Each service produces one file, `{outputDir}/{package path}/{Name}.kt`, where `{Name}` is the service name followed
|
|
14
|
+
* by `_Requests`, cased with `typeNameCasing`. The file is written by the service generator, which defaults to
|
|
15
|
+
* `DefaultKotlinSpringReactiveWebClientGenerator`. The shared `ApiRequestFile.kt` helper is also copied to
|
|
16
|
+
* `{outputDir}/{infrastructure package path}/ApiRequestFile.kt`. Services named `exclude-from-generation` are skipped.
|
|
17
|
+
*
|
|
18
|
+
* Publishes the result under `kotlin.clients`, keyed by service id, with the `typeName` and `packageName` of each
|
|
19
|
+
* requests object, so later generators can import them. Reads the `kotlin.models` output of the models generator.
|
|
20
|
+
*
|
|
21
|
+
* `springBootVersion` has no effect on this generator.
|
|
22
|
+
*
|
|
23
|
+
* @see KotlinSpringReactiveWebClientsGeneratorOutput
|
|
24
|
+
*/
|
|
10
25
|
export declare class KotlinSpringReactiveWebClientsGenerator extends OpenApiServicesGenerationProviderBase<Input, Output, Config, ServiceOutput, Context> {
|
|
11
26
|
private readonly _serviceGeneratorFactory;
|
|
27
|
+
/**
|
|
28
|
+
* Creates the generator.
|
|
29
|
+
* @param serviceGeneratorFactory Creates the generator that writes the client of each service. Defaults to a
|
|
30
|
+
* `DefaultKotlinSpringReactiveWebClientGenerator`.
|
|
31
|
+
*/
|
|
12
32
|
constructor(serviceGeneratorFactory?: Factory<KotlinSpringReactiveWebClientGenerator, []>);
|
|
13
33
|
protected generateAdditionalFiles(ctx: Context): Promise<void>;
|
|
14
34
|
protected initResult(): Output;
|
|
@@ -4,8 +4,28 @@ import { getAssetFileContent } from '../../../assets.js';
|
|
|
4
4
|
import { defaultKotlinSpringReactiveWebClientsGeneratorConfig, } from './models.js';
|
|
5
5
|
import { getReferenceFactories } from './refs.js';
|
|
6
6
|
import { DefaultKotlinSpringReactiveWebClientGenerator, } from './spring-reactive-web-client-generator.js';
|
|
7
|
+
/**
|
|
8
|
+
* Generates a Spring WebFlux `WebClient` based Kotlin client for each service.
|
|
9
|
+
*
|
|
10
|
+
* Each service produces one file, `{outputDir}/{package path}/{Name}.kt`, where `{Name}` is the service name followed
|
|
11
|
+
* by `_Requests`, cased with `typeNameCasing`. The file is written by the service generator, which defaults to
|
|
12
|
+
* `DefaultKotlinSpringReactiveWebClientGenerator`. The shared `ApiRequestFile.kt` helper is also copied to
|
|
13
|
+
* `{outputDir}/{infrastructure package path}/ApiRequestFile.kt`. Services named `exclude-from-generation` are skipped.
|
|
14
|
+
*
|
|
15
|
+
* Publishes the result under `kotlin.clients`, keyed by service id, with the `typeName` and `packageName` of each
|
|
16
|
+
* requests object, so later generators can import them. Reads the `kotlin.models` output of the models generator.
|
|
17
|
+
*
|
|
18
|
+
* `springBootVersion` has no effect on this generator.
|
|
19
|
+
*
|
|
20
|
+
* @see KotlinSpringReactiveWebClientsGeneratorOutput
|
|
21
|
+
*/
|
|
7
22
|
export class KotlinSpringReactiveWebClientsGenerator extends OpenApiServicesGenerationProviderBase {
|
|
8
23
|
_serviceGeneratorFactory;
|
|
24
|
+
/**
|
|
25
|
+
* Creates the generator.
|
|
26
|
+
* @param serviceGeneratorFactory Creates the generator that writes the client of each service. Defaults to a
|
|
27
|
+
* `DefaultKotlinSpringReactiveWebClientGenerator`.
|
|
28
|
+
*/
|
|
9
29
|
constructor(serviceGeneratorFactory) {
|
|
10
30
|
super();
|
|
11
31
|
this._serviceGeneratorFactory =
|