From 49daaf6d383d4535a3fb1b7d3f8b55b5cb86ba7c Mon Sep 17 00:00:00 2001 From: Calvin Bascom Date: Mon, 24 Mar 2025 16:23:23 -0400 Subject: [PATCH] feat: Add type+format mappings for go We now register type+format mappings for the go generator so that types like integer with format uint64 get mapped correctly. --- .../codegen/languages/AbstractGoCodegen.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index fc2a254585ba..ffb6e19ded8a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -117,9 +117,27 @@ public AbstractGoCodegen() { instantiationTypes.put("map", "GoMap");*/ typeMapping.clear(); + typeMapping.put("integer+int8", "int8"); + typeMapping.put("integer+uint8", "uint8"); + typeMapping.put("integer+int16", "int16"); + typeMapping.put("integer+uint16", "uint16"); typeMapping.put("integer", "int32"); + typeMapping.put("integer+int32", "int32"); + typeMapping.put("integer+int64", "int64"); + typeMapping.put("integer+uint32", "uint32"); + typeMapping.put("integer+uint64", "uint64"); typeMapping.put("long", "int64"); + typeMapping.put("number+int8", "int8"); + typeMapping.put("number+uint8", "uint8"); + typeMapping.put("number+int16", "int16"); + typeMapping.put("number+uint16", "uint16"); + typeMapping.put("number+int32", "int32"); + typeMapping.put("number+int64", "int64"); + typeMapping.put("number+uint32", "uint32"); + typeMapping.put("number+uint64", "uint64"); typeMapping.put("number", "float32"); + typeMapping.put("number+float32", "float32"); + typeMapping.put("number+float64", "float64"); typeMapping.put("float", "float32"); typeMapping.put("double", "float64"); typeMapping.put("decimal", "float64");