@@ -80,6 +80,7 @@ public DartDioClientCodegen() {
80
80
81
81
importMapping .put ("BuiltList" , "package:built_collection/built_collection.dart" );
82
82
importMapping .put ("BuiltMap" , "package:built_collection/built_collection.dart" );
83
+ importMapping .put ("JsonObject" , "package:built_value/json_object.dart" );
83
84
importMapping .put ("Uint8List" , "dart:typed_data" );
84
85
}
85
86
@@ -129,6 +130,13 @@ public String toEnumVarName(String name, String datatype) {
129
130
return name ;
130
131
}
131
132
133
+ @ Override
134
+ protected void addAdditionPropertiesToCodeGenModel (CodegenModel codegenModel , Schema schema ) {
135
+ //super.addAdditionPropertiesToCodeGenModel(codegenModel, schema);
136
+ codegenModel .additionalPropertiesType = getSchemaType (ModelUtils .getAdditionalProperties (schema ));
137
+ addImport (codegenModel , codegenModel .additionalPropertiesType );
138
+ }
139
+
132
140
@ Override
133
141
public void processOpts () {
134
142
if (StringUtils .isEmpty (System .getenv ("DART_POST_PROCESS_FILE" ))) {
@@ -230,9 +238,16 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert
230
238
//Updates any List properties on a model to a BuiltList. This happens in post processing rather
231
239
//than type mapping as we only want this to apply to models, not every other class.
232
240
if ("List" .equals (property .baseType )) {
233
- property .setDatatype (property .dataType .replaceAll (property .baseType , "BuiltList" ));
241
+ property .setDatatype (
242
+ property .dataType .replaceAll (property .baseType , "BuiltList" ));
234
243
property .setBaseType ("BuiltList" );
235
244
model .imports .add ("BuiltList" );
245
+ if ("Object" .equals (property .items .baseType )) {
246
+ property .setDatatype (
247
+ property .dataType .replaceAll ("Object" , "JsonObject" ));
248
+ property .items .setDatatype ("JsonObject" );
249
+ model .imports .add ("JsonObject" );
250
+ }
236
251
}
237
252
}
238
253
if (property .isMapContainer ) {
@@ -242,6 +257,11 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert
242
257
property .setDatatype (property .dataType .replaceAll (property .baseType , "BuiltMap" ));
243
258
property .setBaseType ("BuiltMap" );
244
259
model .imports .add ("BuiltMap" );
260
+ if ("Object" .equals (property .items .baseType )) {
261
+ property .setDatatype (property .dataType .replaceAll ("Object" , "JsonObject" ));
262
+ property .items .setDatatype ("JsonObject" );
263
+ model .imports .add ("JsonObject" );
264
+ }
245
265
}
246
266
}
247
267
0 commit comments