From c9c81ea0e12c1b2644c86c70bc1b97ac4c803948 Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Wed, 5 Aug 2026 12:16:05 +0200 Subject: [PATCH] chore: bump go sdk generator to v7.24.0 Update the Go-only openapi-generator-cli version from v7.22.0 to v7.24.0, python and java stay unchanged. The upstream go/client.mustache decode() function gained support for decoding into *io.Reader and *[]byte, carried over into our customized template. Upstream also changed the oneOf "no match" error message, which changed the generated AreaId models (iaas v1/v2/v2beta1) covered by the override mechanism. Updated their hashes in overrides.properties and adopted the improved message in the override files. Signed-off-by: Alexander Dahmen --- languages/golang/templates/api.mustache | 2 +- languages/golang/templates/client.mustache | 11 ++++++++++- languages/golang/templates/configuration.mustache | 2 +- scripts/generate-sdk/generate-sdk.sh | 2 +- .../overrides/go/iaas/v1api/v1api_model_area_id.go | 6 +++++- .../overrides/go/iaas/v2api/v2api_model_area_id.go | 6 +++++- .../go/iaas/v2beta1api/v2beta_model_area_id.go | 6 +++++- scripts/generators/overrides/go/overrides.properties | 6 +++--- 8 files changed, 31 insertions(+), 10 deletions(-) diff --git a/languages/golang/templates/api.mustache b/languages/golang/templates/api.mustache index 7641197d..e2f7592f 100644 --- a/languages/golang/templates/api.mustache +++ b/languages/golang/templates/api.mustache @@ -1,4 +1,4 @@ -{{! This template was customized to use the GenericOpenAPIError from the core module. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/go/api.mustache for the original template }} +{{! This template was customized to use the GenericOpenAPIError from the core module. See https://github.com/OpenAPITools/openapi-generator/blob/v7.24.0/modules/openapi-generator/src/main/resources/go/api.mustache for the original template }} {{>partial_header}} package {{packageName}} diff --git a/languages/golang/templates/client.mustache b/languages/golang/templates/client.mustache index b641c8e7..468df5d2 100644 --- a/languages/golang/templates/client.mustache +++ b/languages/golang/templates/client.mustache @@ -1,4 +1,4 @@ -{{! This template was customized to support the custom configuration options from the core module. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/go/client.mustache for the original template }} +{{! This template was customized to support the custom configuration options from the core module. See https://github.com/OpenAPITools/openapi-generator/blob/v7.24.0/modules/openapi-generator/src/main/resources/go/client.mustache for the original template }} {{>partial_header}} package {{packageName}} @@ -578,6 +578,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } + if r, ok := v.(*io.Reader); ok { + *r = bytes.NewReader(b) + return nil + } + // Must stay before the JSON branch: json.Unmarshal would base64-decode into *[]byte. + if p, ok := v.(*[]byte); ok { + *p = b + return nil + } if f, ok := v.(*os.File); ok { f, err = os.CreateTemp("", "HttpClientFile") if err != nil { diff --git a/languages/golang/templates/configuration.mustache b/languages/golang/templates/configuration.mustache index 028c1651..b295d2d0 100644 --- a/languages/golang/templates/configuration.mustache +++ b/languages/golang/templates/configuration.mustache @@ -1,4 +1,4 @@ -{{! This template was ENTIRELY overwritten to support the custom configuration type and options from the STACKIT SDK core module. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/go/configuration.mustache for the original template }} +{{! This template was ENTIRELY overwritten to support the custom configuration type and options from the STACKIT SDK core module. See https://github.com/OpenAPITools/openapi-generator/blob/v7.24.0/modules/openapi-generator/src/main/resources/go/configuration.mustache for the original template }} {{>partial_header}} package {{packageName}} diff --git a/scripts/generate-sdk/generate-sdk.sh b/scripts/generate-sdk/generate-sdk.sh index 1764f0c1..68b12eea 100755 --- a/scripts/generate-sdk/generate-sdk.sh +++ b/scripts/generate-sdk/generate-sdk.sh @@ -56,7 +56,7 @@ case "${LANGUAGE}" in go) # When the GENERATOR_VERSION changes, migrate also the templates in templates/go # Renovate: datasource=github-tags depName=OpenAPITools/openapi-generator versioning=semver - GENERATOR_VERSION="v7.22.0" + GENERATOR_VERSION="v7.24.0" ;; python) # When the GENERATOR_VERSION changes, migrate also the templates in templates/python diff --git a/scripts/generators/overrides/go/iaas/v1api/v1api_model_area_id.go b/scripts/generators/overrides/go/iaas/v1api/v1api_model_area_id.go index a76c8e71..57aecf28 100644 --- a/scripts/generators/overrides/go/iaas/v1api/v1api_model_area_id.go +++ b/scripts/generators/overrides/go/iaas/v1api/v1api_model_area_id.go @@ -79,7 +79,11 @@ func (dst *AreaId) UnmarshalJSON(data []byte) error { } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + if err != nil { + return fmt.Errorf("data failed to match schemas in oneOf(AreaId): %v", err) + } else { + return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + } } } diff --git a/scripts/generators/overrides/go/iaas/v2api/v2api_model_area_id.go b/scripts/generators/overrides/go/iaas/v2api/v2api_model_area_id.go index bd0b814d..a7bfc21c 100644 --- a/scripts/generators/overrides/go/iaas/v2api/v2api_model_area_id.go +++ b/scripts/generators/overrides/go/iaas/v2api/v2api_model_area_id.go @@ -79,7 +79,11 @@ func (dst *AreaId) UnmarshalJSON(data []byte) error { } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + if err != nil { + return fmt.Errorf("data failed to match schemas in oneOf(AreaId): %v", err) + } else { + return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + } } } diff --git a/scripts/generators/overrides/go/iaas/v2beta1api/v2beta_model_area_id.go b/scripts/generators/overrides/go/iaas/v2beta1api/v2beta_model_area_id.go index d352db30..4d9756ec 100644 --- a/scripts/generators/overrides/go/iaas/v2beta1api/v2beta_model_area_id.go +++ b/scripts/generators/overrides/go/iaas/v2beta1api/v2beta_model_area_id.go @@ -80,7 +80,11 @@ func (dst *AreaId) UnmarshalJSON(data []byte) error { } else if match == 1 { return nil // exactly one match } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + if err != nil { + return fmt.Errorf("data failed to match schemas in oneOf(AreaId): %v", err) + } else { + return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + } } } diff --git a/scripts/generators/overrides/go/overrides.properties b/scripts/generators/overrides/go/overrides.properties index d4b225da..88c812b3 100644 --- a/scripts/generators/overrides/go/overrides.properties +++ b/scripts/generators/overrides/go/overrides.properties @@ -1,11 +1,11 @@ iaasV2ApiAreaId.path=iaas/v2api/model_area_id.go iaasV2ApiAreaId.replacementPath=iaas/v2api/v2api_model_area_id.go -iaasV2ApiAreaId.hash=b7425456c4633b2e8c0a61e9ab3b579e +iaasV2ApiAreaId.hash=fd8a0426a8aefa66a10e7bb81c1cceba iaasV1ApiAreaId.path=iaas/v1api/model_area_id.go iaasV1ApiAreaId.replacementPath=iaas/v1api/v1api_model_area_id.go -iaasV1ApiAreaId.hash=a9d72364fec0794cab3b51f3680de584 +iaasV1ApiAreaId.hash=b5626b52f7d93e9e9e26d679075d7031 iaasV2BetaApiAreaId.path=iaas/v2beta1api/model_area_id.go iaasV2BetaApiAreaId.replacementPath=iaas/v2beta1api/v2beta_model_area_id.go -iaasV2BetaApiAreaId.hash=13e1bd33ceb69aa6a43a89c51c5dbffa +iaasV2BetaApiAreaId.hash=0e4f740cefba5981258cf15ecd995246