Skip to content

Commit 3cbdef1

Browse files
committed
Update
1 parent e954648 commit 3cbdef1

File tree

2 files changed

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

2 files changed

+22
-22
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,17 @@ impl validator::Validate for {{{classname}}}
861861
}
862862
}
863863
864+
/// Converts Query Parameters representation (style=form, explode=false) to a {{{classname}}} value
865+
/// as specified in https://swagger.io/docs/specification/serialization/
866+
/// Should be implemented in a serde deserializer
867+
impl std::str::FromStr for {{{classname}}} {
868+
type Err = serde_json::Error;
869+
870+
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
871+
serde_json::from_str(s)
872+
}
873+
}
874+
864875
{{#discriminator}}
865876
impl serde::Serialize for {{{classname}}} {
866877
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
@@ -876,17 +887,6 @@ impl serde::Serialize for {{{classname}}} {
876887
}
877888
{{/discriminator}}
878889
879-
/// Converts Query Parameters representation (style=form, explode=false) to a {{{classname}}} value
880-
/// as specified in https://swagger.io/docs/specification/serialization/
881-
/// Should be implemented in a serde deserializer
882-
impl std::str::FromStr for {{{classname}}} {
883-
type Err = serde_json::Error;
884-
885-
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
886-
serde_json::from_str(s)
887-
}
888-
}
889-
890890
{{#composedSchemas}}
891891
{{#oneOf}}
892892
{{#vendorExtensions.x-from-trait}}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,17 @@ impl validator::Validate for Message {
990990
}
991991
}
992992

993+
/// Converts Query Parameters representation (style=form, explode=false) to a Message value
994+
/// as specified in https://swagger.io/docs/specification/serialization/
995+
/// Should be implemented in a serde deserializer
996+
impl std::str::FromStr for Message {
997+
type Err = serde_json::Error;
998+
999+
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1000+
serde_json::from_str(s)
1001+
}
1002+
}
1003+
9931004
impl serde::Serialize for Message {
9941005
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
9951006
where
@@ -1004,17 +1015,6 @@ impl serde::Serialize for Message {
10041015
}
10051016
}
10061017

1007-
/// Converts Query Parameters representation (style=form, explode=false) to a Message value
1008-
/// as specified in https://swagger.io/docs/specification/serialization/
1009-
/// Should be implemented in a serde deserializer
1010-
impl std::str::FromStr for Message {
1011-
type Err = serde_json::Error;
1012-
1013-
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1014-
serde_json::from_str(s)
1015-
}
1016-
}
1017-
10181018
impl From<models::Hello> for Message {
10191019
fn from(value: models::Hello) -> Self {
10201020
Self::Hello(value)

0 commit comments

Comments
 (0)