Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust-Axum] Support quotes in string literals #20176

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
}
}
Expand Down Expand Up @@ -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,
}
}
Expand Down Expand Up @@ -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,
}
}
Expand Down Expand Up @@ -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()),
}
}
}
Expand Down
Loading