@@ -1604,12 +1604,24 @@ public String getterAndSetterCapitalize(String name) {
1604
1604
* @return Codegen Property object
1605
1605
*/
1606
1606
public CodegenProperty fromProperty (String name , Property p ) {
1607
+ return fromProperty (name , p , null );
1608
+ }
1609
+ /**
1610
+ * Convert Swagger Property object to Codegen Property object
1611
+ *
1612
+ * @param name name of the property
1613
+ * @param p Swagger property object
1614
+ * @param itemsDepth the depth in nested containers or null
1615
+ * @return Codegen Property object
1616
+ */
1617
+ private CodegenProperty fromProperty (String name , Property p , Integer itemsDepth ) {
1607
1618
if (p == null ) {
1608
1619
LOGGER .error ("unexpected missing property for name " + name );
1609
1620
return null ;
1610
1621
}
1611
1622
1612
1623
CodegenProperty property = CodegenModelFactory .newInstance (CodegenModelType .PROPERTY );
1624
+ property .itemsDepth = itemsDepth ;
1613
1625
property .name = toVarName (name );
1614
1626
property .baseName = name ;
1615
1627
property .nameInCamelCase = camelize (property .name , false );
@@ -1872,7 +1884,8 @@ public CodegenProperty fromProperty(String name, Property p) {
1872
1884
if (itemName == null ) {
1873
1885
itemName = property .name ;
1874
1886
}
1875
- CodegenProperty cp = fromProperty (itemName , ap .getItems ());
1887
+ CodegenProperty cp = fromProperty (itemName , ap .getItems (),
1888
+ itemsDepth == null ? 1 : itemsDepth .intValue () + 1 );
1876
1889
updatePropertyForArray (property , cp );
1877
1890
} else if (p instanceof MapProperty ) {
1878
1891
MapProperty ap = (MapProperty ) p ;
@@ -1885,7 +1898,8 @@ public CodegenProperty fromProperty(String name, Property p) {
1885
1898
property .maxItems = ap .getMaxProperties ();
1886
1899
1887
1900
// handle inner property
1888
- CodegenProperty cp = fromProperty ("inner" , ap .getAdditionalProperties ());
1901
+ CodegenProperty cp = fromProperty ("inner" , ap .getAdditionalProperties (),
1902
+ itemsDepth == null ? 1 : itemsDepth .intValue () + 1 );
1889
1903
updatePropertyForMap (property , cp );
1890
1904
} else {
1891
1905
setNonArrayMapProperty (property , type );
@@ -3088,10 +3102,10 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera
3088
3102
}
3089
3103
3090
3104
private void addParentContainer (CodegenModel m , String name , Property property ) {
3091
- final CodegenProperty tmp = fromProperty (name , property );
3092
- addImport (m , tmp .complexType );
3105
+ m . parentContainer = fromProperty (name , property );
3106
+ addImport (m , m . parentContainer .complexType );
3093
3107
m .parent = toInstantiationType (property );
3094
- final String containerType = tmp .containerType ;
3108
+ final String containerType = m . parentContainer .containerType ;
3095
3109
final String instantiationType = instantiationTypes .get (containerType );
3096
3110
if (instantiationType != null ) {
3097
3111
addImport (m , instantiationType );
0 commit comments