@@ -193,21 +193,50 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert
193193 property .enumName = property .datatypeWithEnum ;
194194
195195 property .allowableValues = property .items .allowableValues ;
196+ } else if (property .isContainer &&
197+ property .isArray &&
198+ property .containerType != null && property .containerType .equals ("array" ) &&
199+ property .items != null && !property .items .isEnum && !(property .complexType == null ) &&
200+ (!property .dataType .contains ("[Dictionary]" ) || !property .datatypeWithEnum .contains ("[Dictionary]" ))) {
201+
202+ property .dataType = "[" + property .items .dataType + "]" ;;
203+ property .datatypeWithEnum = "[" + property .items .datatypeWithEnum + "]" ;;
204+ property .complexType = "[" + property .items .complexType + "]" ;;
205+ property .containerType = property .items .containerType ;
196206 }
197207 property .dataType = property .dataType .replace ("[Dictionary]" , "[[String:JSON]]" );
198208 property .datatypeWithEnum = property .datatypeWithEnum .replace ("[Dictionary]" , "[[String:JSON]]" );
199209
200210 if (property .baseType .equals ("StringJSON" ) && !(property .complexType == null )) {
201- if (!property .datatypeWithEnum .contains ("[[String:JSON]]" ) || !property .dataType .contains ("[[String:JSON]]" )) {
202- boolean startsWithThing = property .dataType .startsWith ("[" ) || property .datatypeWithEnum .startsWith ("[" );
211+ if ((!property .datatypeWithEnum .contains ("[[String:JSON]]" ) && !property .datatypeWithEnum .contains ("[[String]]" )) ||
212+ (!property .dataType .contains ("[[String:JSON]]" ) && !property .dataType .contains ("[[String]]" ))) {
213+ boolean startsWithArray = property .dataType .startsWith ("[" ) || property .datatypeWithEnum .startsWith ("[" );
203214 property .dataType = toModelName (property .dataType );
204215 property .datatypeWithEnum = toModelName (property .datatypeWithEnum );
205216
206- if (startsWithThing && !property .dataType .startsWith ("[" ) || !property .datatypeWithEnum .startsWith ("[" )) {
217+ if (startsWithArray && ( !property .dataType .startsWith ("[" ) || !property .datatypeWithEnum .startsWith ("[" ) )) {
207218 property .dataType = "[" + property .dataType + "]" ;
208219 property .datatypeWithEnum = "[" + property .datatypeWithEnum + "]" ;
209220 }
210221 }
222+ } else if (!property .baseType .equals ("StringJSON" ) && !(property .complexType == null )) {
223+ boolean startsWithArray = property .dataType .startsWith ("[" ) || property .datatypeWithEnum .startsWith ("[" );
224+ boolean startsWithStringMap = property .dataType .startsWith ("[String:" ) || property .datatypeWithEnum .startsWith ("[String:" );
225+ boolean startsWithStringMapArray = property .dataType .startsWith ("[String:[" ) || property .datatypeWithEnum .startsWith ("[String:[" );
226+ property .dataType = toModelName (property .dataType );
227+ property .datatypeWithEnum = toModelName (property .datatypeWithEnum );
228+
229+ if (startsWithArray && (!property .dataType .startsWith ("[" ) || !property .datatypeWithEnum .startsWith ("[" ))) {
230+ property .dataType = "[" + property .dataType + "]" ;
231+ property .datatypeWithEnum = "[" + property .datatypeWithEnum + "]" ;
232+ if (startsWithStringMapArray && (!property .dataType .startsWith ("[String:[" ) || !property .datatypeWithEnum .startsWith ("[String:[" ))) {
233+ property .dataType = property .dataType .replace ("[String" , "[String:[" ) + "]" ;;
234+ property .datatypeWithEnum = property .datatypeWithEnum .replace ("[String" , "[String:[" ) + "]" ;;
235+ } else if (startsWithStringMap && (!property .dataType .startsWith ("[String:" ) || !property .datatypeWithEnum .startsWith ("[String:" ))) {
236+ property .dataType = property .dataType .replace ("[String" , "[String:" );
237+ property .datatypeWithEnum = property .datatypeWithEnum .replace ("[String" , "[String:" );
238+ }
239+ }
211240 }
212241 }
213242}
0 commit comments