Skip to content

Commit 924f0e5

Browse files
- line break
- add aws-sdk-unstable - bug fix
1 parent dee9fd5 commit 924f0e5

File tree

2 files changed

+38
-13
lines changed

2 files changed

+38
-13
lines changed

codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientDocs.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ object FluentClientDocs {
222222
}
223223
}
224224
}
225+
1

codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class FluentClientGenerator(
270270
val errorType = symbolProvider.symbolForOperationError(operation)
271271
val inputBuilderType = symbolProvider.symbolForBuilder(input)
272272
val fnName = clientOperationFnName(operation, symbolProvider)
273-
// Have to use fully-qualified result here or else it could conflict with an op named Result
273+
274274
// Have to use fully-qualified result here or else it could conflict with an op named Result
275275
rustTemplate(
276276
"""
@@ -310,18 +310,6 @@ class FluentClientGenerator(
310310
self.handle.client.call(op).await
311311
}
312312
313-
/// This function replaces the parameter with new one.
314-
/// It is useful when you want to replace the existing data with de-serialized data.
315-
/// ```compile_fail
316-
/// let result_future = async {
317-
/// let deserialized_parameters: $inputBuilderType = serde_json::from_str("some json data").unwrap();
318-
/// client.$fnName().set_fields(&deserialized_parameters).send().await
319-
/// };
320-
/// ```
321-
pub fn set_fields(mut self, data: $inputBuilderType) -> Self {
322-
self.inner = data;
323-
self
324-
}
325313
""",
326314
"CustomizableOperation" to codegenContext.featureGatedCustomizeModule().toType()
327315
.resolve("CustomizableOperation"),
@@ -337,6 +325,42 @@ class FluentClientGenerator(
337325
generics.toRustGenerics(),
338326
),
339327
)
328+
329+
// this fixes this error
330+
// error[E0592]: duplicate definitions with name `set_fields`
331+
// --> sdk/connectcases/src/operation/update_case/builders.rs:115:5
332+
// |
333+
// 78 | / pub fn set_fields(
334+
// 79 | | mut self,
335+
// 80 | | data: crate::operation::update_case::builders::UpdateCaseInputBuilder,
336+
// 81 | | ) -> Self {
337+
// | |_____________- other definition for `set_fields`
338+
// ...
339+
// 115 | / pub fn set_fields(
340+
// 116 | | mut self,
341+
// 117 | | input: std::option::Option<std::vec::Vec<crate::types::FieldValue>>,
342+
// 118 | | ) -> Self {
343+
// | |_____________^ duplicate definitions for `set_fields`
344+
if (inputBuilderType.toString().endsWith("Builder")) {
345+
rustTemplate("""
346+
##[cfg(#{AwsSdkUnstableAttribute:W})]
347+
/// This function replaces the parameter with new one.
348+
/// It is useful when you want to replace the existing data with de-serialized data.
349+
/// ```compile_fail
350+
/// let result_future = async {
351+
/// let deserialized_parameters: $inputBuilderType = serde_json::from_str(&json_string).unwrap();
352+
/// client.$fnName().set_fields(&deserialized_parameters).send().await
353+
/// };
354+
/// ```
355+
pub fn set_fields(mut self, data: $inputBuilderType) -> Self {
356+
self.inner = data;
357+
self
358+
}
359+
""",
360+
"AwsSdkUnstableAttribute" to Attribute.AwsSdkUnstableAttribute,
361+
)
362+
}
363+
340364
PaginatorGenerator.paginatorType(codegenContext, generics, operation, retryClassifier)?.also { paginatorType ->
341365
rustTemplate(
342366
"""

0 commit comments

Comments
 (0)