diff --git a/k8s-openapi-codegen-common/src/templates/type_header.rs b/k8s-openapi-codegen-common/src/templates/type_header.rs index a70295bf4..40c6c6f4f 100644 --- a/k8s-openapi-codegen-common/src/templates/type_header.rs +++ b/k8s-openapi-codegen-common/src/templates/type_header.rs @@ -6,9 +6,14 @@ pub(crate) fn generate( derives: Option, vis: &str, ) -> Result<(), crate::Error> { - let type_comment: String = + let type_comment = type_comment - .map(|type_comment| crate::get_comment_text(type_comment, "").map(|line| format!("///{line}\n")).collect()) + .map(|type_comment| crate::get_comment_text(type_comment, "").fold(String::new(), |mut result, line| { + result.push_str("///"); + result.push_str(&line); + result.push('\n'); + result + })) .unwrap_or_default(); let type_feature_attribute =