Skip to content

Commit 01139e6

Browse files
authored
[rust-axum] don't include quotes in output string from Display trait for string types (#22161)
* [rust-axum] don't include quotes in output string from Display trait for string types * [rust-axum] update samples
1 parent e7dae1a commit 01139e6

File tree

4 files changed

+11
-11
lines changed
  • modules/openapi-generator/src/main/resources/rust-axum
  • samples/server/petstore/rust-axum/output

4 files changed

+11
-11
lines changed

modules/openapi-generator/src/main/resources/rust-axum/models.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ impl std::convert::From<{{{dataType}}}> for {{{classname}}} {
630630
631631
impl std::fmt::Display for {{{classname}}} {
632632
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
633-
write!(f, "{:?}", self.0)
633+
write!(f, "{}", self.0)
634634
}
635635
}
636636

samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl std::convert::From<String> for AnotherXmlInner {
611611

612612
impl std::fmt::Display for AnotherXmlInner {
613613
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
614-
write!(f, "{:?}", self.0)
614+
write!(f, "{}", self.0)
615615
}
616616
}
617617

@@ -1255,7 +1255,7 @@ impl std::convert::From<String> for Err {
12551255

12561256
impl std::fmt::Display for Err {
12571257
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1258-
write!(f, "{:?}", self.0)
1258+
write!(f, "{}", self.0)
12591259
}
12601260
}
12611261

@@ -1303,7 +1303,7 @@ impl std::convert::From<String> for Error {
13031303

13041304
impl std::fmt::Display for Error {
13051305
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1306-
write!(f, "{:?}", self.0)
1306+
write!(f, "{}", self.0)
13071307
}
13081308
}
13091309

@@ -1833,7 +1833,7 @@ impl std::convert::From<String> for NullableObject {
18331833

18341834
impl std::fmt::Display for NullableObject {
18351835
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1836-
write!(f, "{:?}", self.0)
1836+
write!(f, "{}", self.0)
18371837
}
18381838
}
18391839

@@ -2809,7 +2809,7 @@ impl std::convert::From<String> for Ok {
28092809

28102810
impl std::fmt::Display for Ok {
28112811
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2812-
write!(f, "{:?}", self.0)
2812+
write!(f, "{}", self.0)
28132813
}
28142814
}
28152815

@@ -2966,7 +2966,7 @@ impl std::convert::From<String> for Result {
29662966

29672967
impl std::fmt::Display for Result {
29682968
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2969-
write!(f, "{:?}", self.0)
2969+
write!(f, "{}", self.0)
29702970
}
29712971
}
29722972

@@ -3057,7 +3057,7 @@ impl std::convert::From<String> for StringObject {
30573057

30583058
impl std::fmt::Display for StringObject {
30593059
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3060-
write!(f, "{:?}", self.0)
3060+
write!(f, "{}", self.0)
30613061
}
30623062
}
30633063

@@ -3282,7 +3282,7 @@ impl std::convert::From<String> for XmlInner {
32823282

32833283
impl std::fmt::Display for XmlInner {
32843284
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3285-
write!(f, "{:?}", self.0)
3285+
write!(f, "{}", self.0)
32863286
}
32873287
}
32883288

samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4909,7 +4909,7 @@ impl std::convert::From<String> for OuterString {
49094909

49104910
impl std::fmt::Display for OuterString {
49114911
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4912-
write!(f, "{:?}", self.0)
4912+
write!(f, "{}", self.0)
49134913
}
49144914
}
49154915

samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl std::convert::From<String> for Email {
8686

8787
impl std::fmt::Display for Email {
8888
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
89-
write!(f, "{:?}", self.0)
89+
write!(f, "{}", self.0)
9090
}
9191
}
9292

0 commit comments

Comments
 (0)