Loading CHANGELOG.md +2 −0 Original line number Diff line number Diff line vNext (Month Day, Year) ----------------------- **New this week** - (When complete) Add profile file provider for region (#594, #xyz) - Add experimental `dvr` module to smithy-client. This will enable easier testing of HTTP traffic. (#640) - Add profile file credential provider implementation. This implementation currently does not support credential sources for assume role providers other than environment variables. (#640) - :bug: Fix name collision that occurred when a model had both a union and a structure named `Result` (#643) v0.20 (August 10th, 2021) -------------------------- Loading codegen-test/build.gradle.kts +7 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,13 @@ val CodegenTests = listOf( ), CodegenTest( "crate#Config", "naming_test", """ "naming_test_ops", """ , "codegen": { "renameErrors": false } """.trimIndent() ), CodegenTest( "naming_obs_structs#NamingObstacleCourseStructs", "naming_test_structs", """ , "codegen": { "renameErrors": false } """.trimIndent() ) Loading codegen-test/model/naming-obstacle-course.smithy→codegen-test/model/naming-obstacle-course-ops.smithy +0 −0 File moved. View file codegen-test/model/naming-obstacle-course-structs.smithy 0 → 100644 +53 −0 Original line number Diff line number Diff line $version: "1.0" namespace naming_obs_structs use aws.protocols#awsJson1_1 use aws.api#service /// Confounds model generation machinery with lots of problematic names @awsJson1_1 @service(sdkId: "NamingObstacleCourseStructs") service NamingObstacleCourseStructs { version: "2006-03-01", operations: [ Structs, ] } structure SomethingElse { result: Result, resultList: ResultList, option: Option, optionList: OptionList, someUnion: SomeUnion, } union SomeUnion { Result: Result, Option: Option, } structure Result { value: String, } list ResultList { member: Result, } structure Option { value: String, } list OptionList { member: Result, } structure StructsInputOutput { result: Result, resultList: ResultList, option: Option, optionList: OptionList, somethingElse: SomethingElse, } operation Structs { input: StructsInputOutput, output: StructsInputOutput } codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/UnionGenerator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class UnionGenerator( if (sortedMembers.size == 1) { Attribute.Custom("allow(irrefutable_let_patterns)").render(this) } rustBlock("pub fn as_$funcNamePart(&self) -> Result<&#T, &Self>", memberSymbol) { rustBlock("pub fn as_$funcNamePart(&self) -> std::result::Result<&#T, &Self>", memberSymbol) { rust("if let ${unionSymbol.name}::$variantName(val) = &self { Ok(&val) } else { Err(&self) }") } rustBlock("pub fn is_$funcNamePart(&self) -> bool") { Loading Loading
CHANGELOG.md +2 −0 Original line number Diff line number Diff line vNext (Month Day, Year) ----------------------- **New this week** - (When complete) Add profile file provider for region (#594, #xyz) - Add experimental `dvr` module to smithy-client. This will enable easier testing of HTTP traffic. (#640) - Add profile file credential provider implementation. This implementation currently does not support credential sources for assume role providers other than environment variables. (#640) - :bug: Fix name collision that occurred when a model had both a union and a structure named `Result` (#643) v0.20 (August 10th, 2021) -------------------------- Loading
codegen-test/build.gradle.kts +7 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,13 @@ val CodegenTests = listOf( ), CodegenTest( "crate#Config", "naming_test", """ "naming_test_ops", """ , "codegen": { "renameErrors": false } """.trimIndent() ), CodegenTest( "naming_obs_structs#NamingObstacleCourseStructs", "naming_test_structs", """ , "codegen": { "renameErrors": false } """.trimIndent() ) Loading
codegen-test/model/naming-obstacle-course.smithy→codegen-test/model/naming-obstacle-course-ops.smithy +0 −0 File moved. View file
codegen-test/model/naming-obstacle-course-structs.smithy 0 → 100644 +53 −0 Original line number Diff line number Diff line $version: "1.0" namespace naming_obs_structs use aws.protocols#awsJson1_1 use aws.api#service /// Confounds model generation machinery with lots of problematic names @awsJson1_1 @service(sdkId: "NamingObstacleCourseStructs") service NamingObstacleCourseStructs { version: "2006-03-01", operations: [ Structs, ] } structure SomethingElse { result: Result, resultList: ResultList, option: Option, optionList: OptionList, someUnion: SomeUnion, } union SomeUnion { Result: Result, Option: Option, } structure Result { value: String, } list ResultList { member: Result, } structure Option { value: String, } list OptionList { member: Result, } structure StructsInputOutput { result: Result, resultList: ResultList, option: Option, optionList: OptionList, somethingElse: SomethingElse, } operation Structs { input: StructsInputOutput, output: StructsInputOutput }
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/UnionGenerator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class UnionGenerator( if (sortedMembers.size == 1) { Attribute.Custom("allow(irrefutable_let_patterns)").render(this) } rustBlock("pub fn as_$funcNamePart(&self) -> Result<&#T, &Self>", memberSymbol) { rustBlock("pub fn as_$funcNamePart(&self) -> std::result::Result<&#T, &Self>", memberSymbol) { rust("if let ${unionSymbol.name}::$variantName(val) = &self { Ok(&val) } else { Err(&self) }") } rustBlock("pub fn is_$funcNamePart(&self) -> bool") { Loading