diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java index 4a35fc695dc4..059d6ac6fb54 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java @@ -809,7 +809,7 @@ public String toDefaultValue(final Schema p) { } } else if (ModelUtils.isStringSchema(p)) { if (p.getDefault() != null) { - defaultValue = "\"" + p.getDefault() + "\".to_string()"; + defaultValue = "r#\"" + p.getDefault() + "\"#.to_string()"; } } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs index 5437c7abd43b..b484a7a0ce3b 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs @@ -1827,7 +1827,7 @@ impl NullableTest { NullableTest { nullable, nullable_with_null_default: None, - nullable_with_present_default: Some(Nullable::Present("default".to_string())), + nullable_with_present_default: Some(Nullable::Present(r#"default"#.to_string())), nullable_with_no_default: None, nullable_array: None, min_item_test: None, diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs index 65d9e95ad9ec..47e78e88d90c 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs @@ -309,7 +309,7 @@ impl Animal { pub fn new(class_name: String) -> Animal { Animal { class_name, - color: Some("red".to_string()), + color: Some(r#"red"#.to_string()), } } } @@ -1460,7 +1460,7 @@ impl Cat { pub fn new(class_name: String) -> Cat { Cat { class_name, - color: Some("red".to_string()), + color: Some(r#"red"#.to_string()), declawed: None, } } @@ -2041,7 +2041,7 @@ impl Dog { pub fn new(class_name: String) -> Dog { Dog { class_name, - color: Some("red".to_string()), + color: Some(r#"red"#.to_string()), breed: None, } } @@ -5858,7 +5858,7 @@ impl TestEnumParametersRequest { #[allow(clippy::new_without_default, clippy::too_many_arguments)] pub fn new() -> TestEnumParametersRequest { TestEnumParametersRequest { - enum_form_string: Some("-efg".to_string()), + enum_form_string: Some(r#"-efg"#.to_string()), } } }