@@ -42,10 +42,6 @@ public class TypeScriptRxjsClientCodegen extends AbstractTypeScriptClientCodegen
42
42
public TypeScriptRxjsClientCodegen () {
43
43
super ();
44
44
45
- // clear import mapping (from default generator) as TS does not use it
46
- // at the moment
47
- importMapping .clear ();
48
-
49
45
outputFolder = "generated-code/typescript-rxjs" ;
50
46
embeddedTemplateDir = templateDir = "typescript-rxjs" ;
51
47
@@ -55,6 +51,9 @@ public TypeScriptRxjsClientCodegen() {
55
51
this .modelTemplateFiles .put ("models.mustache" , ".ts" );
56
52
this .addExtraReservedWords ();
57
53
54
+ languageSpecificPrimitives .add ("Blob" );
55
+ typeMapping .put ("file" , "Blob" );
56
+
58
57
this .cliOptions .add (new CliOption (NPM_REPOSITORY , "Use this property to set an url your private npmRepo in the package.json" ));
59
58
this .cliOptions .add (new CliOption (WITH_INTERFACES , "Setting this property to true will generate interfaces next to the default class implementations." , SchemaTypeUtil .BOOLEAN_TYPE ).defaultValue (Boolean .FALSE .toString ()));
60
59
}
@@ -93,6 +92,11 @@ public void processOpts() {
93
92
}
94
93
}
95
94
95
+ @ Override
96
+ public boolean isDataTypeFile (final String dataType ) {
97
+ return dataType != null && dataType .equals ("Blob" );
98
+ }
99
+
96
100
@ Override
97
101
public String getTypeDeclaration (Schema p ) {
98
102
Schema inner ;
@@ -162,6 +166,33 @@ public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
162
166
return result ;
163
167
}
164
168
169
+ @ Override
170
+ public void postProcessParameter (CodegenParameter parameter ) {
171
+ super .postProcessParameter (parameter );
172
+ parameter .dataType = applyLocalTypeMapping (parameter .dataType );
173
+ }
174
+
175
+ @ Override
176
+ public String getSchemaType (Schema p ) {
177
+ String openAPIType = super .getSchemaType (p );
178
+ if (isLanguagePrimitive (openAPIType )) {
179
+ return openAPIType ;
180
+ }
181
+ applyLocalTypeMapping (openAPIType );
182
+ return openAPIType ;
183
+ }
184
+
185
+ private String applyLocalTypeMapping (String type ) {
186
+ if (typeMapping .containsKey (type )) {
187
+ type = typeMapping .get (type );
188
+ }
189
+ return type ;
190
+ }
191
+
192
+ private boolean isLanguagePrimitive (String type ) {
193
+ return languageSpecificPrimitives .contains (type );
194
+ }
195
+
165
196
private void addNpmPackageGeneration () {
166
197
if (additionalProperties .containsKey (NPM_REPOSITORY )) {
167
198
this .setNpmRepository (additionalProperties .get (NPM_REPOSITORY ).toString ());
@@ -290,10 +321,10 @@ private void addExtraReservedWords() {
290
321
this .reservedWords .add ("ModelPropertyNaming" );
291
322
this .reservedWords .add ("RequestArgs" );
292
323
this .reservedWords .add ("RequestOpts" );
324
+ this .reservedWords .add ("ResponseArgs" );
293
325
this .reservedWords .add ("exists" );
294
- this .reservedWords .add ("RequestContext" );
295
- this .reservedWords .add ("ResponseContext" );
296
326
this .reservedWords .add ("Middleware" );
327
+ this .reservedWords .add ("AjaxRequest" );
297
328
this .reservedWords .add ("AjaxResponse" );
298
329
}
299
330
@@ -310,6 +341,7 @@ public ExtendedCodegenOperation(CodegenOperation o) {
310
341
this .hasProduces = o .hasProduces ;
311
342
this .hasParams = o .hasParams ;
312
343
this .hasOptionalParams = o .hasOptionalParams ;
344
+ this .hasRequiredParams = o .hasRequiredParams ;
313
345
this .returnTypeIsPrimitive = o .returnTypeIsPrimitive ;
314
346
this .returnSimpleType = o .returnSimpleType ;
315
347
this .subresourceOperation = o .subresourceOperation ;
@@ -318,13 +350,16 @@ public ExtendedCodegenOperation(CodegenOperation o) {
318
350
this .isMultipart = o .isMultipart ;
319
351
this .hasMore = o .hasMore ;
320
352
this .isResponseBinary = o .isResponseBinary ;
353
+ this .isResponseFile = o .isResponseFile ;
321
354
this .hasReference = o .hasReference ;
322
355
this .isRestfulIndex = o .isRestfulIndex ;
323
356
this .isRestfulShow = o .isRestfulShow ;
324
357
this .isRestfulCreate = o .isRestfulCreate ;
325
358
this .isRestfulUpdate = o .isRestfulUpdate ;
326
359
this .isRestfulDestroy = o .isRestfulDestroy ;
327
360
this .isRestful = o .isRestful ;
361
+ this .isDeprecated = o .isDeprecated ;
362
+ this .isCallbackRequest = o .isCallbackRequest ;
328
363
this .path = o .path ;
329
364
this .operationId = o .operationId ;
330
365
this .returnType = o .returnType ;
@@ -339,25 +374,32 @@ public ExtendedCodegenOperation(CodegenOperation o) {
339
374
this .discriminator = o .discriminator ;
340
375
this .consumes = o .consumes ;
341
376
this .produces = o .produces ;
377
+ this .prioritizedContentTypes = o .prioritizedContentTypes ;
378
+ this .servers = o .servers ;
342
379
this .bodyParam = o .bodyParam ;
343
380
this .allParams = o .allParams ;
344
381
this .bodyParams = o .bodyParams ;
345
382
this .pathParams = o .pathParams ;
346
383
this .queryParams = o .queryParams ;
347
384
this .headerParams = o .headerParams ;
348
385
this .formParams = o .formParams ;
386
+ this .cookieParams = o .cookieParams ;
349
387
this .requiredParams = o .requiredParams ;
350
388
this .optionalParams = o .optionalParams ;
351
389
this .authMethods = o .authMethods ;
352
390
this .tags = o .tags ;
353
391
this .responses = o .responses ;
392
+ this .callbacks = o .callbacks ;
354
393
this .imports = o .imports ;
355
394
this .examples = o .examples ;
395
+ this .requestBodyExamples = o .requestBodyExamples ;
356
396
this .externalDocs = o .externalDocs ;
357
397
this .vendorExtensions = o .vendorExtensions ;
358
398
this .nickname = o .nickname ;
399
+ this .operationIdOriginal = o .operationIdOriginal ;
359
400
this .operationIdLowerCase = o .operationIdLowerCase ;
360
401
this .operationIdCamelCase = o .operationIdCamelCase ;
402
+ this .operationIdSnakeCase = o .operationIdSnakeCase ;
361
403
362
404
// new fields
363
405
this .hasHttpHeaders = o .getHasHeaderParams () || o .getHasBodyParam () || o .hasAuthMethods ;
0 commit comments