Server Test Python

Server Test Python

rev. 6fc7cbedb5b89510be0908913ad355c54b288f28 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/src/model.rs

@@ -1796,1796 +1863,1857 @@
 1816   1816   
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
 1817   1817   
        ///
 1818   1818   
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
 1819   1819   
            self.build_enforcing_all_constraints()
 1820   1820   
        }
 1821   1821   
        fn build_enforcing_all_constraints(
 1822   1822   
            self,
 1823   1823   
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
 1824   1824   
            Ok(crate::model::TopLevel {
 1825   1825   
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 1826         -
                dialog_list: self.dialog_list.unwrap_or_else(
 1827         -
                    #[allow(clippy::redundant_closure)]
 1828         -
                    || ::std::vec::Vec::new(),
 1829         -
                ),
 1830         -
                dialog_map: self.dialog_map.unwrap_or_else(
 1831         -
                    #[allow(clippy::redundant_closure)]
 1832         -
                    || ::std::collections::HashMap::new(),
 1833         -
                ),
        1826  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        1827  +
                dialog_map: self.dialog_map.unwrap_or_default(),
 1834   1828   
            })
 1835   1829   
        }
 1836   1830   
    }
 1837   1831   
}
 1838   1832   
/// See [`TopLevel`](crate::model::TopLevel).
 1839   1833   
pub mod top_level {
 1840   1834   
 1841   1835   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1842   1836   
    /// Holds one variant for each of the ways the builder can fail.
 1843   1837   
@@ -1877,1871 +1944,1932 @@
 1897   1891   
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if you do not provide a value for all non-`Option`al members.
 1898   1892   
        ///
 1899   1893   
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
 1900   1894   
            self.build_enforcing_required_and_enum_traits()
 1901   1895   
        }
 1902   1896   
        fn build_enforcing_required_and_enum_traits(
 1903   1897   
            self,
 1904   1898   
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
 1905   1899   
            Ok(crate::model::TopLevel {
 1906   1900   
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 1907         -
                dialog_list: self.dialog_list.unwrap_or_else(
 1908         -
                    #[allow(clippy::redundant_closure)]
 1909         -
                    || ::std::vec::Vec::new(),
 1910         -
                ),
 1911         -
                dialog_map: self.dialog_map.unwrap_or_else(
 1912         -
                    #[allow(clippy::redundant_closure)]
 1913         -
                    || ::std::collections::HashMap::new(),
 1914         -
                ),
        1901  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        1902  +
                dialog_map: self.dialog_map.unwrap_or_default(),
 1915   1903   
            })
 1916   1904   
        }
 1917   1905   
    }
 1918   1906   
}
 1919   1907   
/// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
 1920   1908   
pub(crate) mod client_optional_defaults_internal {
 1921   1909   
 1922   1910   
    impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
 1923   1911   
        fn from(builder: Builder) -> Self {
 1924   1912   
            builder.build()
@@ -2245,2233 +2348,2330 @@
 2265   2253   
        }
 2266   2254   
        fn build_enforcing_all_constraints(
 2267   2255   
            self,
 2268   2256   
        ) -> Result<crate::model::Defaults, ConstraintViolation> {
 2269   2257   
            Ok(crate::model::Defaults {
 2270   2258   
                default_string: self.default_string.unwrap_or_else(
 2271   2259   
                    #[allow(clippy::redundant_closure)]
 2272   2260   
                    || String::from("hi"),
 2273   2261   
                ),
 2274   2262   
                default_boolean: self.default_boolean.unwrap_or(true),
 2275         -
                default_list: self.default_list.unwrap_or_else(
 2276         -
                    #[allow(clippy::redundant_closure)]
 2277         -
                    || ::std::vec::Vec::new(),
 2278         -
                ),
        2263  +
                default_list: self.default_list.unwrap_or_default(),
 2279   2264   
                default_document_map: self.default_document_map.unwrap_or_else(
 2280   2265   
                    #[allow(clippy::redundant_closure)]
 2281   2266   
                    || {
 2282   2267   
                        ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 2283   2268   
                            .into()
 2284   2269   
                    },
 2285   2270   
                ),
 2286   2271   
                default_document_string: self.default_document_string.unwrap_or_else(
 2287   2272   
                    #[allow(clippy::redundant_closure)]
 2288   2273   
                    || {
 2289   2274   
                        ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 2290   2275   
                            .into()
 2291   2276   
                    },
 2292   2277   
                ),
 2293   2278   
                default_document_boolean: self
 2294   2279   
                    .default_document_boolean
 2295   2280   
                    .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
 2296   2281   
                default_document_list: self.default_document_list.unwrap_or_else(
 2297   2282   
                    #[allow(clippy::redundant_closure)]
 2298   2283   
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
 2299   2284   
                ),
 2300   2285   
                default_null_document: self.default_null_document,
 2301   2286   
                default_timestamp: self.default_timestamp.unwrap_or_else(
 2302   2287   
                    #[allow(clippy::redundant_closure)]
 2303   2288   
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
 2304   2289   
                ),
 2305   2290   
                default_blob: self.default_blob.unwrap_or_else(
 2306   2291   
                    #[allow(clippy::redundant_closure)]
 2307   2292   
                    || ::aws_smithy_types::Blob::new("abc").into(),
 2308   2293   
                ),
 2309   2294   
                default_byte: self.default_byte.unwrap_or(1i8),
 2310   2295   
                default_short: self.default_short.unwrap_or(1i16),
 2311   2296   
                default_integer: self.default_integer.unwrap_or(10i32),
 2312   2297   
                default_long: self.default_long.unwrap_or(100i64),
 2313   2298   
                default_float: self.default_float.unwrap_or(1.0f32),
 2314   2299   
                default_double: self.default_double.unwrap_or(1.0f64),
 2315         -
                default_map: self.default_map.unwrap_or_else(
 2316         -
                    #[allow(clippy::redundant_closure)]
 2317         -
                    || ::std::collections::HashMap::new(),
 2318         -
                ),
        2300  +
                default_map: self.default_map.unwrap_or_default(),
 2319   2301   
                default_enum: self
 2320   2302   
                    .default_enum
 2321   2303   
                    .map(|v| match v {
 2322   2304   
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
 2323   2305   
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
 2324   2306   
                    })
 2325   2307   
                    .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
 2326   2308   
                    .transpose()?
 2327   2309   
                    .unwrap_or(
 2328   2310   
                        "FOO"
@@ -2544,2526 +2647,2623 @@
 2564   2546   
        pub fn build(self) -> crate::model::Defaults {
 2565   2547   
            self.build_enforcing_required_and_enum_traits()
 2566   2548   
        }
 2567   2549   
        fn build_enforcing_required_and_enum_traits(self) -> crate::model::Defaults {
 2568   2550   
            crate::model::Defaults {
 2569   2551   
                default_string: self.default_string.unwrap_or_else(
 2570   2552   
                    #[allow(clippy::redundant_closure)]
 2571   2553   
                    || String::from("hi"),
 2572   2554   
                ),
 2573   2555   
                default_boolean: self.default_boolean.unwrap_or(true),
 2574         -
                default_list: self.default_list.unwrap_or_else(
 2575         -
                    #[allow(clippy::redundant_closure)]
 2576         -
                    || ::std::vec::Vec::new(),
 2577         -
                ),
        2556  +
                default_list: self.default_list.unwrap_or_default(),
 2578   2557   
                default_document_map: self.default_document_map.unwrap_or_else(
 2579   2558   
                    #[allow(clippy::redundant_closure)]
 2580   2559   
                    || {
 2581   2560   
                        ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 2582   2561   
                            .into()
 2583   2562   
                    },
 2584   2563   
                ),
 2585   2564   
                default_document_string: self.default_document_string.unwrap_or_else(
 2586   2565   
                    #[allow(clippy::redundant_closure)]
 2587   2566   
                    || {
 2588   2567   
                        ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 2589   2568   
                            .into()
 2590   2569   
                    },
 2591   2570   
                ),
 2592   2571   
                default_document_boolean: self
 2593   2572   
                    .default_document_boolean
 2594   2573   
                    .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
 2595   2574   
                default_document_list: self.default_document_list.unwrap_or_else(
 2596   2575   
                    #[allow(clippy::redundant_closure)]
 2597   2576   
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
 2598   2577   
                ),
 2599   2578   
                default_null_document: self.default_null_document,
 2600   2579   
                default_timestamp: self.default_timestamp.unwrap_or_else(
 2601   2580   
                    #[allow(clippy::redundant_closure)]
 2602   2581   
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
 2603   2582   
                ),
 2604   2583   
                default_blob: self.default_blob.unwrap_or_else(
 2605   2584   
                    #[allow(clippy::redundant_closure)]
 2606   2585   
                    || ::aws_smithy_types::Blob::new("abc").into(),
 2607   2586   
                ),
 2608   2587   
                default_byte: self.default_byte.unwrap_or(1i8),
 2609   2588   
                default_short: self.default_short.unwrap_or(1i16),
 2610   2589   
                default_integer: self.default_integer.unwrap_or(10i32),
 2611   2590   
                default_long: self.default_long.unwrap_or(100i64),
 2612   2591   
                default_float: self.default_float.unwrap_or(1.0f32),
 2613   2592   
                default_double: self.default_double.unwrap_or(1.0f64),
 2614         -
                default_map: self.default_map.unwrap_or_else(
 2615         -
                    #[allow(clippy::redundant_closure)]
 2616         -
                    || ::std::collections::HashMap::new(),
 2617         -
                ),
        2593  +
                default_map: self.default_map.unwrap_or_default(),
 2618   2594   
                default_enum: self.default_enum.unwrap_or(
 2619   2595   
                    "FOO"
 2620   2596   
                        .parse::<crate::model::TestEnum>()
 2621   2597   
                        .expect("static value validated to member"),
 2622   2598   
                ),
 2623   2599   
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
 2624   2600   
                empty_string: self.empty_string.unwrap_or_else(
 2625   2601   
                    #[allow(clippy::redundant_closure)]
 2626   2602   
                    || String::from(""),
 2627   2603   
                ),

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/src/output.rs

@@ -1156,1156 +1223,1217 @@
 1176   1176   
        ) -> Result<crate::output::OperationWithNestedStructureOutput, ConstraintViolation>
 1177   1177   
        {
 1178   1178   
            self.build_enforcing_required_and_enum_traits()
 1179   1179   
        }
 1180   1180   
        fn build_enforcing_required_and_enum_traits(
 1181   1181   
            self,
 1182   1182   
        ) -> Result<crate::output::OperationWithNestedStructureOutput, ConstraintViolation>
 1183   1183   
        {
 1184   1184   
            Ok(crate::output::OperationWithNestedStructureOutput {
 1185   1185   
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 1186         -
                dialog_list: self.dialog_list.unwrap_or_else(
 1187         -
                    #[allow(clippy::redundant_closure)]
 1188         -
                    || ::std::vec::Vec::new(),
 1189         -
                ),
 1190         -
                dialog_map: self.dialog_map.unwrap_or_else(
 1191         -
                    #[allow(clippy::redundant_closure)]
 1192         -
                    || ::std::collections::HashMap::new(),
 1193         -
                ),
        1186  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        1187  +
                dialog_map: self.dialog_map.unwrap_or_default(),
 1194   1188   
            })
 1195   1189   
        }
 1196   1190   
    }
 1197   1191   
}
 1198   1192   
/// See [`OperationWithRequiredMembersOutput`](crate::output::OperationWithRequiredMembersOutput).
 1199   1193   
pub mod operation_with_required_members_output {
 1200   1194   
 1201   1195   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1202   1196   
    /// Holds one variant for each of the ways the builder can fail.
 1203   1197   
@@ -1596,1590 +1699,1687 @@
 1616   1610   
        }
 1617   1611   
        fn build_enforcing_required_and_enum_traits(
 1618   1612   
            self,
 1619   1613   
        ) -> crate::output::OperationWithDefaultsOutput {
 1620   1614   
            crate::output::OperationWithDefaultsOutput {
 1621   1615   
                default_string: self.default_string.unwrap_or_else(
 1622   1616   
                    #[allow(clippy::redundant_closure)]
 1623   1617   
                    || String::from("hi"),
 1624   1618   
                ),
 1625   1619   
                default_boolean: self.default_boolean.unwrap_or(true),
 1626         -
                default_list: self.default_list.unwrap_or_else(
 1627         -
                    #[allow(clippy::redundant_closure)]
 1628         -
                    || ::std::vec::Vec::new(),
 1629         -
                ),
        1620  +
                default_list: self.default_list.unwrap_or_default(),
 1630   1621   
                default_document_map: self.default_document_map.unwrap_or_else(
 1631   1622   
                    #[allow(clippy::redundant_closure)]
 1632   1623   
                    || {
 1633   1624   
                        ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 1634   1625   
                            .into()
 1635   1626   
                    },
 1636   1627   
                ),
 1637   1628   
                default_document_string: self.default_document_string.unwrap_or_else(
 1638   1629   
                    #[allow(clippy::redundant_closure)]
 1639   1630   
                    || {
 1640   1631   
                        ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 1641   1632   
                            .into()
 1642   1633   
                    },
 1643   1634   
                ),
 1644   1635   
                default_document_boolean: self
 1645   1636   
                    .default_document_boolean
 1646   1637   
                    .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
 1647   1638   
                default_document_list: self.default_document_list.unwrap_or_else(
 1648   1639   
                    #[allow(clippy::redundant_closure)]
 1649   1640   
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
 1650   1641   
                ),
 1651   1642   
                default_null_document: self.default_null_document,
 1652   1643   
                default_timestamp: self.default_timestamp.unwrap_or_else(
 1653   1644   
                    #[allow(clippy::redundant_closure)]
 1654   1645   
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
 1655   1646   
                ),
 1656   1647   
                default_blob: self.default_blob.unwrap_or_else(
 1657   1648   
                    #[allow(clippy::redundant_closure)]
 1658   1649   
                    || ::aws_smithy_types::Blob::new("abc").into(),
 1659   1650   
                ),
 1660   1651   
                default_byte: self.default_byte.unwrap_or(1i8),
 1661   1652   
                default_short: self.default_short.unwrap_or(1i16),
 1662   1653   
                default_integer: self.default_integer.unwrap_or(10i32),
 1663   1654   
                default_long: self.default_long.unwrap_or(100i64),
 1664   1655   
                default_float: self.default_float.unwrap_or(1.0f32),
 1665   1656   
                default_double: self.default_double.unwrap_or(1.0f64),
 1666         -
                default_map: self.default_map.unwrap_or_else(
 1667         -
                    #[allow(clippy::redundant_closure)]
 1668         -
                    || ::std::collections::HashMap::new(),
 1669         -
                ),
        1657  +
                default_map: self.default_map.unwrap_or_default(),
 1670   1658   
                default_enum: self.default_enum.unwrap_or(
 1671   1659   
                    "FOO"
 1672   1660   
                        .parse::<crate::model::TestEnum>()
 1673   1661   
                        .expect("static value validated to member"),
 1674   1662   
                ),
 1675   1663   
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
 1676   1664   
                empty_string: self.empty_string.unwrap_or_else(
 1677   1665   
                    #[allow(clippy::redundant_closure)]
 1678   1666   
                    || String::from(""),
 1679   1667   
                ),

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/model.rs

@@ -3071,3071 +3138,3132 @@
 3091   3091   
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
 3092   3092   
        ///
 3093   3093   
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
 3094   3094   
            self.build_enforcing_all_constraints()
 3095   3095   
        }
 3096   3096   
        fn build_enforcing_all_constraints(
 3097   3097   
            self,
 3098   3098   
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
 3099   3099   
            Ok(crate::model::TopLevel {
 3100   3100   
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 3101         -
                dialog_list: self.dialog_list.unwrap_or_else(
 3102         -
                    #[allow(clippy::redundant_closure)]
 3103         -
                    || ::std::vec::Vec::new(),
 3104         -
                ),
 3105         -
                dialog_map: self.dialog_map.unwrap_or_else(
 3106         -
                    #[allow(clippy::redundant_closure)]
 3107         -
                    || ::std::collections::HashMap::new(),
 3108         -
                ),
        3101  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        3102  +
                dialog_map: self.dialog_map.unwrap_or_default(),
 3109   3103   
            })
 3110   3104   
        }
 3111   3105   
    }
 3112   3106   
}
 3113   3107   
/// See [`TopLevel`](crate::model::TopLevel).
 3114   3108   
pub mod top_level {
 3115   3109   
 3116   3110   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 3117   3111   
    /// Holds one variant for each of the ways the builder can fail.
 3118   3112   
@@ -3152,3146 +3219,3207 @@
 3172   3166   
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if you do not provide a value for all non-`Option`al members.
 3173   3167   
        ///
 3174   3168   
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
 3175   3169   
            self.build_enforcing_required_and_enum_traits()
 3176   3170   
        }
 3177   3171   
        fn build_enforcing_required_and_enum_traits(
 3178   3172   
            self,
 3179   3173   
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
 3180   3174   
            Ok(crate::model::TopLevel {
 3181   3175   
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 3182         -
                dialog_list: self.dialog_list.unwrap_or_else(
 3183         -
                    #[allow(clippy::redundant_closure)]
 3184         -
                    || ::std::vec::Vec::new(),
 3185         -
                ),
 3186         -
                dialog_map: self.dialog_map.unwrap_or_else(
 3187         -
                    #[allow(clippy::redundant_closure)]
 3188         -
                    || ::std::collections::HashMap::new(),
 3189         -
                ),
        3176  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        3177  +
                dialog_map: self.dialog_map.unwrap_or_default(),
 3190   3178   
            })
 3191   3179   
        }
 3192   3180   
    }
 3193   3181   
}
 3194   3182   
/// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
 3195   3183   
pub(crate) mod client_optional_defaults_internal {
 3196   3184   
 3197   3185   
    impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
 3198   3186   
        fn from(builder: Builder) -> Self {
 3199   3187   
            builder.build()
@@ -3520,3508 +3623,3605 @@
 3540   3528   
        }
 3541   3529   
        fn build_enforcing_all_constraints(
 3542   3530   
            self,
 3543   3531   
        ) -> Result<crate::model::Defaults, ConstraintViolation> {
 3544   3532   
            Ok(crate::model::Defaults {
 3545   3533   
                default_string: self.default_string.unwrap_or_else(
 3546   3534   
                    #[allow(clippy::redundant_closure)]
 3547   3535   
                    || String::from("hi"),
 3548   3536   
                ),
 3549   3537   
                default_boolean: self.default_boolean.unwrap_or(true),
 3550         -
                default_list: self.default_list.unwrap_or_else(
 3551         -
                    #[allow(clippy::redundant_closure)]
 3552         -
                    || ::std::vec::Vec::new(),
 3553         -
                ),
        3538  +
                default_list: self.default_list.unwrap_or_default(),
 3554   3539   
                default_document_map: self.default_document_map.unwrap_or_else(
 3555   3540   
                    #[allow(clippy::redundant_closure)]
 3556   3541   
                    || {
 3557   3542   
                        ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 3558   3543   
                            .into()
 3559   3544   
                    },
 3560   3545   
                ),
 3561   3546   
                default_document_string: self.default_document_string.unwrap_or_else(
 3562   3547   
                    #[allow(clippy::redundant_closure)]
 3563   3548   
                    || {
 3564   3549   
                        ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 3565   3550   
                            .into()
 3566   3551   
                    },
 3567   3552   
                ),
 3568   3553   
                default_document_boolean: self
 3569   3554   
                    .default_document_boolean
 3570   3555   
                    .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
 3571   3556   
                default_document_list: self.default_document_list.unwrap_or_else(
 3572   3557   
                    #[allow(clippy::redundant_closure)]
 3573   3558   
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
 3574   3559   
                ),
 3575   3560   
                default_null_document: self.default_null_document,
 3576   3561   
                default_timestamp: self.default_timestamp.unwrap_or_else(
 3577   3562   
                    #[allow(clippy::redundant_closure)]
 3578   3563   
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
 3579   3564   
                ),
 3580   3565   
                default_blob: self.default_blob.unwrap_or_else(
 3581   3566   
                    #[allow(clippy::redundant_closure)]
 3582   3567   
                    || ::aws_smithy_types::Blob::new("abc").into(),
 3583   3568   
                ),
 3584   3569   
                default_byte: self.default_byte.unwrap_or(1i8),
 3585   3570   
                default_short: self.default_short.unwrap_or(1i16),
 3586   3571   
                default_integer: self.default_integer.unwrap_or(10i32),
 3587   3572   
                default_long: self.default_long.unwrap_or(100i64),
 3588   3573   
                default_float: self.default_float.unwrap_or(1.0f32),
 3589   3574   
                default_double: self.default_double.unwrap_or(1.0f64),
 3590         -
                default_map: self.default_map.unwrap_or_else(
 3591         -
                    #[allow(clippy::redundant_closure)]
 3592         -
                    || ::std::collections::HashMap::new(),
 3593         -
                ),
        3575  +
                default_map: self.default_map.unwrap_or_default(),
 3594   3576   
                default_enum: self
 3595   3577   
                    .default_enum
 3596   3578   
                    .map(|v| match v {
 3597   3579   
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
 3598   3580   
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
 3599   3581   
                    })
 3600   3582   
                    .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
 3601   3583   
                    .transpose()?
 3602   3584   
                    .unwrap_or(
 3603   3585   
                        "FOO"
@@ -3819,3801 +3922,3898 @@
 3839   3821   
        pub fn build(self) -> crate::model::Defaults {
 3840   3822   
            self.build_enforcing_required_and_enum_traits()
 3841   3823   
        }
 3842   3824   
        fn build_enforcing_required_and_enum_traits(self) -> crate::model::Defaults {
 3843   3825   
            crate::model::Defaults {
 3844   3826   
                default_string: self.default_string.unwrap_or_else(
 3845   3827   
                    #[allow(clippy::redundant_closure)]
 3846   3828   
                    || String::from("hi"),
 3847   3829   
                ),
 3848   3830   
                default_boolean: self.default_boolean.unwrap_or(true),
 3849         -
                default_list: self.default_list.unwrap_or_else(
 3850         -
                    #[allow(clippy::redundant_closure)]
 3851         -
                    || ::std::vec::Vec::new(),
 3852         -
                ),
        3831  +
                default_list: self.default_list.unwrap_or_default(),
 3853   3832   
                default_document_map: self.default_document_map.unwrap_or_else(
 3854   3833   
                    #[allow(clippy::redundant_closure)]
 3855   3834   
                    || {
 3856   3835   
                        ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 3857   3836   
                            .into()
 3858   3837   
                    },
 3859   3838   
                ),
 3860   3839   
                default_document_string: self.default_document_string.unwrap_or_else(
 3861   3840   
                    #[allow(clippy::redundant_closure)]
 3862   3841   
                    || {
 3863   3842   
                        ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 3864   3843   
                            .into()
 3865   3844   
                    },
 3866   3845   
                ),
 3867   3846   
                default_document_boolean: self
 3868   3847   
                    .default_document_boolean
 3869   3848   
                    .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
 3870   3849   
                default_document_list: self.default_document_list.unwrap_or_else(
 3871   3850   
                    #[allow(clippy::redundant_closure)]
 3872   3851   
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
 3873   3852   
                ),
 3874   3853   
                default_null_document: self.default_null_document,
 3875   3854   
                default_timestamp: self.default_timestamp.unwrap_or_else(
 3876   3855   
                    #[allow(clippy::redundant_closure)]
 3877   3856   
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
 3878   3857   
                ),
 3879   3858   
                default_blob: self.default_blob.unwrap_or_else(
 3880   3859   
                    #[allow(clippy::redundant_closure)]
 3881   3860   
                    || ::aws_smithy_types::Blob::new("abc").into(),
 3882   3861   
                ),
 3883   3862   
                default_byte: self.default_byte.unwrap_or(1i8),
 3884   3863   
                default_short: self.default_short.unwrap_or(1i16),
 3885   3864   
                default_integer: self.default_integer.unwrap_or(10i32),
 3886   3865   
                default_long: self.default_long.unwrap_or(100i64),
 3887   3866   
                default_float: self.default_float.unwrap_or(1.0f32),
 3888   3867   
                default_double: self.default_double.unwrap_or(1.0f64),
 3889         -
                default_map: self.default_map.unwrap_or_else(
 3890         -
                    #[allow(clippy::redundant_closure)]
 3891         -
                    || ::std::collections::HashMap::new(),
 3892         -
                ),
        3868  +
                default_map: self.default_map.unwrap_or_default(),
 3893   3869   
                default_enum: self.default_enum.unwrap_or(
 3894   3870   
                    "FOO"
 3895   3871   
                        .parse::<crate::model::TestEnum>()
 3896   3872   
                        .expect("static value validated to member"),
 3897   3873   
                ),
 3898   3874   
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
 3899   3875   
                empty_string: self.empty_string.unwrap_or_else(
 3900   3876   
                    #[allow(clippy::redundant_closure)]
 3901   3877   
                    || String::from(""),
 3902   3878   
                ),

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/output.rs

@@ -6224,6224 +6291,6285 @@
 6244   6244   
        ) -> Result<crate::output::OperationWithNestedStructureOutput, ConstraintViolation>
 6245   6245   
        {
 6246   6246   
            self.build_enforcing_required_and_enum_traits()
 6247   6247   
        }
 6248   6248   
        fn build_enforcing_required_and_enum_traits(
 6249   6249   
            self,
 6250   6250   
        ) -> Result<crate::output::OperationWithNestedStructureOutput, ConstraintViolation>
 6251   6251   
        {
 6252   6252   
            Ok(crate::output::OperationWithNestedStructureOutput {
 6253   6253   
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 6254         -
                dialog_list: self.dialog_list.unwrap_or_else(
 6255         -
                    #[allow(clippy::redundant_closure)]
 6256         -
                    || ::std::vec::Vec::new(),
 6257         -
                ),
 6258         -
                dialog_map: self.dialog_map.unwrap_or_else(
 6259         -
                    #[allow(clippy::redundant_closure)]
 6260         -
                    || ::std::collections::HashMap::new(),
 6261         -
                ),
        6254  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        6255  +
                dialog_map: self.dialog_map.unwrap_or_default(),
 6262   6256   
            })
 6263   6257   
        }
 6264   6258   
    }
 6265   6259   
}
 6266   6260   
/// See [`OperationWithDefaultsOutput`](crate::output::OperationWithDefaultsOutput).
 6267   6261   
pub mod operation_with_defaults_output {
 6268   6262   
 6269   6263   
    impl ::std::convert::From<Builder> for crate::output::OperationWithDefaultsOutput {
 6270   6264   
        fn from(builder: Builder) -> Self {
 6271   6265   
            builder.build()
@@ -6460,6454 +6563,6551 @@
 6480   6474   
        }
 6481   6475   
        fn build_enforcing_required_and_enum_traits(
 6482   6476   
            self,
 6483   6477   
        ) -> crate::output::OperationWithDefaultsOutput {
 6484   6478   
            crate::output::OperationWithDefaultsOutput {
 6485   6479   
                default_string: self.default_string.unwrap_or_else(
 6486   6480   
                    #[allow(clippy::redundant_closure)]
 6487   6481   
                    || String::from("hi"),
 6488   6482   
                ),
 6489   6483   
                default_boolean: self.default_boolean.unwrap_or(true),
 6490         -
                default_list: self.default_list.unwrap_or_else(
 6491         -
                    #[allow(clippy::redundant_closure)]
 6492         -
                    || ::std::vec::Vec::new(),
 6493         -
                ),
        6484  +
                default_list: self.default_list.unwrap_or_default(),
 6494   6485   
                default_document_map: self.default_document_map.unwrap_or_else(
 6495   6486   
                    #[allow(clippy::redundant_closure)]
 6496   6487   
                    || {
 6497   6488   
                        ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 6498   6489   
                            .into()
 6499   6490   
                    },
 6500   6491   
                ),
 6501   6492   
                default_document_string: self.default_document_string.unwrap_or_else(
 6502   6493   
                    #[allow(clippy::redundant_closure)]
 6503   6494   
                    || {
 6504   6495   
                        ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 6505   6496   
                            .into()
 6506   6497   
                    },
 6507   6498   
                ),
 6508   6499   
                default_document_boolean: self
 6509   6500   
                    .default_document_boolean
 6510   6501   
                    .unwrap_or(::aws_smithy_types::Document::Bool(true).into()),
 6511   6502   
                default_document_list: self.default_document_list.unwrap_or_else(
 6512   6503   
                    #[allow(clippy::redundant_closure)]
 6513   6504   
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()).into(),
 6514   6505   
                ),
 6515   6506   
                default_null_document: self.default_null_document,
 6516   6507   
                default_timestamp: self.default_timestamp.unwrap_or_else(
 6517   6508   
                    #[allow(clippy::redundant_closure)]
 6518   6509   
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64).into(),
 6519   6510   
                ),
 6520   6511   
                default_blob: self.default_blob.unwrap_or_else(
 6521   6512   
                    #[allow(clippy::redundant_closure)]
 6522   6513   
                    || ::aws_smithy_types::Blob::new("abc").into(),
 6523   6514   
                ),
 6524   6515   
                default_byte: self.default_byte.unwrap_or(1i8),
 6525   6516   
                default_short: self.default_short.unwrap_or(1i16),
 6526   6517   
                default_integer: self.default_integer.unwrap_or(10i32),
 6527   6518   
                default_long: self.default_long.unwrap_or(100i64),
 6528   6519   
                default_float: self.default_float.unwrap_or(1.0f32),
 6529   6520   
                default_double: self.default_double.unwrap_or(1.0f64),
 6530         -
                default_map: self.default_map.unwrap_or_else(
 6531         -
                    #[allow(clippy::redundant_closure)]
 6532         -
                    || ::std::collections::HashMap::new(),
 6533         -
                ),
        6521  +
                default_map: self.default_map.unwrap_or_default(),
 6534   6522   
                default_enum: self.default_enum.unwrap_or(
 6535   6523   
                    "FOO"
 6536   6524   
                        .parse::<crate::model::TestEnum>()
 6537   6525   
                        .expect("static value validated to member"),
 6538   6526   
                ),
 6539   6527   
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
 6540   6528   
                empty_string: self.empty_string.unwrap_or_else(
 6541   6529   
                    #[allow(clippy::redundant_closure)]
 6542   6530   
                    || String::from(""),
 6543   6531   
                ),