Skip to content

Commit f30eacb

Browse files
fix: guard putAdditionalProperty in setter against models without additionalProperties
Generating the putAdditionalProperty call when additionalProperties is false would cause a compile error because putAdditionalProperty is only generated for models that have an additionalProperties schema. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7e893c3 commit f30eacb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.generator/src/generator/templates/modelSimple.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
258258
{%- else %}
259259
this.{{ variableName }} = {{ variableName }};
260260
{%- endif %}
261-
{%- if model.get("x-keep-typed-in-additional-properties") %}
261+
{%- if model.get("x-keep-typed-in-additional-properties") and model.additionalProperties is not false %}
262262
putAdditionalProperty(JSON_PROPERTY_{{ attr|snake_case|upper }}, {%- if not isRequired and isNullable %} this.{{ variableName }}.orElse(null){%- else %} {{ variableName }}{%- endif %});
263263
{%- endif %}
264264
}

0 commit comments

Comments
 (0)