diff --git a/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeConversion.swift b/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeConversion.swift index b47587b..2051bc4 100644 --- a/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeConversion.swift +++ b/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeConversion.swift @@ -156,13 +156,14 @@ internal extension ServiceModelCodeGenerator { isRequired: true) let fullKeyTypeName = keyTypeName.isBuiltinType ? keyTypeName : "\(baseName)Model.\(keyTypeName)" - let fullValueTypeName = valueTypeName.isBuiltinType ? valueTypeName : "\(baseName)Model.\(valueTypeName)" - - let capitalizedVariableName = variableName.lowerToUpperCamelCase - let fieldType = "[\(fullKeyTypeName): \(fullValueTypeName)]\(optionalInfix)" // if there is actually conversion on each element - if conversionDetails.conversion != "entry" { + if conversionDetails.conversion != "entry" && !valueTypeName.isBuiltinType { + let fullValueTypeName = "\(baseName)Model.\(valueTypeName)" + + let capitalizedVariableName = variableName.lowerToUpperCamelCase + let fieldType = "[\(fullKeyTypeName): \(fullValueTypeName)]\(optionalInfix)" + var setupBuilder = "let converted\(capitalizedVariableName): \(fieldType) = \(failPostfix)\(variableName)\(optionalInfix).mapValues { entry in\n" diff --git a/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeUtilityFunctions.swift b/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeUtilityFunctions.swift index 9a4df11..45dfabf 100644 --- a/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeUtilityFunctions.swift +++ b/Sources/ServiceModelGenerate/ServiceModelCodeGenerator+shapeUtilityFunctions.swift @@ -180,6 +180,8 @@ public extension ServiceModelCodeGenerator { shapeCategory = .collectionType("\(collectionAssociatedType) == [\(keyTypeName): \(valueTypeName)]") } + } else if fieldName.isBuiltinType { + shapeCategory = .builtInType(fieldName) } else { shapeCategory = .protocolType("\(typeName)Shape") }