Skip to content

Commit

Permalink
Re-generate test output with latest fix.
Browse files Browse the repository at this point in the history
See the prior commit, Fix (and test) a missing fully-qualified `String` use.

This commit is just the changes to the automatically-generated test outputs.
  • Loading branch information
anelson committed Dec 2, 2024
1 parent 246dbfb commit 5170d76
Show file tree
Hide file tree
Showing 16 changed files with 10,848 additions and 9 deletions.
9 changes: 5 additions & 4 deletions cargo-typify/tests/outputs/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ impl Veggies {
pub mod builder {
#[derive(Clone, Debug)]
pub struct Veggie {
veggie_like: ::std::result::Result<bool, String>,
veggie_name: ::std::result::Result<::std::string::String, String>,
veggie_like: ::std::result::Result<bool, ::std::string::String>,
veggie_name: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl Default for Veggie {
fn default() -> Self {
Expand Down Expand Up @@ -253,8 +253,9 @@ pub mod builder {
}
#[derive(Clone, Debug)]
pub struct Veggies {
fruits: ::std::result::Result<::std::vec::Vec<::std::string::String>, String>,
vegetables: ::std::result::Result<::std::vec::Vec<super::Veggie>, String>,
fruits:
::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>,
vegetables: ::std::result::Result<::std::vec::Vec<super::Veggie>, ::std::string::String>,
}
impl Default for Veggies {
fn default() -> Self {
Expand Down
10 changes: 5 additions & 5 deletions typify-impl/tests/generator.out
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ mod types {
pub mod builder {
#[derive(Clone, Debug)]
pub struct AllTheTraits {
ok: ::std::result::Result<::std::string::String, String>,
ok: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl Default for AllTheTraits {
fn default() -> Self {
Expand Down Expand Up @@ -267,8 +267,8 @@ mod types {
}
#[derive(Clone, Debug)]
pub struct CompoundType {
value1: ::std::result::Result<::std::string::String, String>,
value2: ::std::result::Result<u64, String>,
value1: ::std::result::Result<::std::string::String, ::std::string::String>,
value2: ::std::result::Result<u64, ::std::string::String>,
}
impl Default for CompoundType {
fn default() -> Self {
Expand Down Expand Up @@ -321,8 +321,8 @@ mod types {
}
#[derive(Clone, Debug)]
pub struct Pair {
a: ::std::result::Result<super::StringEnum, String>,
b: ::std::result::Result<super::StringEnum, String>,
a: ::std::result::Result<super::StringEnum, ::std::string::String>,
b: ::std::result::Result<super::StringEnum, ::std::string::String>,
}
impl Default for Pair {
fn default() -> Self {
Expand Down
60 changes: 60 additions & 0 deletions typify/tests/schemas/deny-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ impl From<&TestType> for TestType {
value.clone()
}
}
impl TestType {
pub fn builder() -> builder::TestType {
Default::default()
}
}
#[doc = "TestTypeWhereNot"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
Expand Down Expand Up @@ -178,4 +183,59 @@ impl<'de> ::serde::Deserialize<'de> for TestTypeWhyNot {
.map_err(|e| <D::Error as ::serde::de::Error>::custom(e.to_string()))
}
}
#[doc = r" Types for composing complex structures."]
pub mod builder {
#[derive(Clone, Debug)]
pub struct TestType {
where_not: ::std::result::Result<super::TestTypeWhereNot, ::std::string::String>,
why_not: ::std::result::Result<super::TestTypeWhyNot, ::std::string::String>,
}
impl Default for TestType {
fn default() -> Self {
Self {
where_not: Err("no value supplied for where_not".to_string()),
why_not: Err("no value supplied for why_not".to_string()),
}
}
}
impl TestType {
pub fn where_not<T>(mut self, value: T) -> Self
where
T: std::convert::TryInto<super::TestTypeWhereNot>,
T::Error: std::fmt::Display,
{
self.where_not = value
.try_into()
.map_err(|e| format!("error converting supplied value for where_not: {}", e));
self
}
pub fn why_not<T>(mut self, value: T) -> Self
where
T: std::convert::TryInto<super::TestTypeWhyNot>,
T::Error: std::fmt::Display,
{
self.why_not = value
.try_into()
.map_err(|e| format!("error converting supplied value for why_not: {}", e));
self
}
}
impl ::std::convert::TryFrom<TestType> for super::TestType {
type Error = super::error::ConversionError;
fn try_from(value: TestType) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
where_not: value.where_not?,
why_not: value.why_not?,
})
}
}
impl From<super::TestType> for TestType {
fn from(value: super::TestType) -> Self {
Self {
where_not: Ok(value.where_not),
why_not: Ok(value.why_not),
}
}
}
}
fn main() {}
51 changes: 51 additions & 0 deletions typify/tests/schemas/extraneous-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ impl From<&LetterBox> for LetterBox {
value.clone()
}
}
impl LetterBox {
pub fn builder() -> builder::LetterBox {
Default::default()
}
}
#[doc = "LetterBoxLetter"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
Expand Down Expand Up @@ -135,4 +140,50 @@ impl std::convert::TryFrom<::std::string::String> for LetterBoxLetter {
value.parse()
}
}
#[doc = r" Types for composing complex structures."]
pub mod builder {
#[derive(Clone, Debug)]
pub struct LetterBox {
letter: ::std::result::Result<
::std::option::Option<super::LetterBoxLetter>,
::std::string::String,
>,
}
impl Default for LetterBox {
fn default() -> Self {
Self {
letter: Ok(Default::default()),
}
}
}
impl LetterBox {
pub fn letter<T>(mut self, value: T) -> Self
where
T: std::convert::TryInto<::std::option::Option<super::LetterBoxLetter>>,
T::Error: std::fmt::Display,
{
self.letter = value
.try_into()
.map_err(|e| format!("error converting supplied value for letter: {}", e));
self
}
}
impl ::std::convert::TryFrom<LetterBox> for super::LetterBox {
type Error = super::error::ConversionError;
fn try_from(
value: LetterBox,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
letter: value.letter?,
})
}
}
impl From<super::LetterBox> for LetterBox {
fn from(value: super::LetterBox) -> Self {
Self {
letter: Ok(value.letter),
}
}
}
}
fn main() {}
Loading

0 comments on commit 5170d76

Please sign in to comment.