From ac1be51823d516ad85f6cd288f4cf8b88a1021a1 Mon Sep 17 00:00:00 2001 From: sks Date: Sat, 28 Jun 2025 19:16:27 -0700 Subject: [PATCH] [go][client] Allow for unknown field if AdditionalProperties is set to true - Probable fix for https://github.com/OpenAPITools/openapi-generator/issues/21446 --- .../src/main/resources/go/model_simple.mustache | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/go/model_simple.mustache b/modules/openapi-generator/src/main/resources/go/model_simple.mustache index 6e60c6a180df..0c99883ca925 100644 --- a/modules/openapi-generator/src/main/resources/go/model_simple.mustache +++ b/modules/openapi-generator/src/main/resources/go/model_simple.mustache @@ -548,7 +548,9 @@ func (o *{{{classname}}}) UnmarshalJSON(data []byte) (err error) { var{{{classname}}} := _{{{classname}}}{} decoder := json.NewDecoder(bytes.NewReader(data)) +{{#isAdditionalPropertiesTrue}} decoder.DisallowUnknownFields() +{{/isAdditionalPropertiesTrue}} err = decoder.Decode(&var{{{classname}}}) if err != nil {