File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ def get_name(schema):
109109 return name
110110
111111
112- def type_to_java (schema , alternative_name = None ):
112+ def type_to_java (schema , alternative_name = None , render_new = False ):
113113 """Return Java type name for the type."""
114114 prefix = ""
115115 if "enum" not in schema :
@@ -146,6 +146,8 @@ def type_to_java(schema, alternative_name=None):
146146 return "List<{}>" .format (name )
147147 elif type_ == "object" :
148148 if has_additional_properties (schema ) and not schema .get ("properties" ):
149+ if render_new :
150+ return "HashMap<String, {}>" .format (type_to_java (schema ["additionalProperties" ]))
149151 return "Map<String, {}>" .format (type_to_java (schema ["additionalProperties" ]))
150152
151153 if schema .get ("parent" ) and not alternative_name :
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
3636 {% - if "items" in schema %}
3737 private {{ dataType }} {{ variableName }}{% - if isRequired %} = new ArrayList<> (){% - else %} = null{% - endif %} ;
3838 {% - elif (isAdditionalPropertiesContainer ) or (not schema .get ("type" ) and "oneOf" not in schema ) %}
39- private {{ dataType }} {{ variableName }}{% - if isRequired %} = new {{ dataType }}(){% - else %} = null{% - endif %} ;
39+ private {{ dataType }} {{ variableName }}{% - if isRequired %} = new {{ get_type(schema, render_new=True) }}(){% - else %} = null{% - endif %} ;
4040 {% - else %}
4141 private {{ dataType }} {{ variableName }}{% - if defaultValue != None %} = {{ defaultValue|format_value(schema=schema, default_value=True, type_=dataType) }}{% - endif %} ;
4242 {% - endif %}
You can’t perform that action at this time.
0 commit comments