-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC30/Set fields to fluent builder #2310
RFC30/Set fields to fluent builder #2310
Conversation
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Outdated
Show resolved
Hide resolved
$cfgAttribute | ||
/// This function replaces the parameter with new one. | ||
/// It is useful when you want to replace the existing data with de-serialized data. | ||
pub fn set_fields(mut self, data: #{InputBuilderType}) -> Self { | ||
self.inner = data; | ||
self | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a crate-specific or even generic pseudo-code example would be helpful here. Without that, it's hard to understand how this will interact with the existing code. The doc comment says
"This function replaces the parameter with new one."
but it looks like it would replace ALL parameters with whatever was in InputBuilderType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#{InputBuilderType}
is the builder type of the operation.
So, if the fluent builder you are building is S3's aws_sdk_s3::client::fluent_builders::CopyObject
then the builder type would be crate::input::copy_object_input::Builder
.
generated code would look like this.
pub struct CopyObject {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::copy_object_input::Builder,
}
impl CopyObject {
/// Creates a new `CopyObject`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
#[cfg(aws_sdk_unstable)]
/// This function replaces the parameter with new one.
/// It is useful when you want to replace the existing data with de-serialized data.
pub fn set_fields(
mut self,
data: crate::input::copy_object_input::Builder,
) -> Self {
self.inner = data;
self
}
there is a bug. let me fix it up |
cfg to Attribute class
9753015
to
32ab211
Compare
@Velfi |
* add line (smithy-lang#2311) * RFC30/Set fields to fluent builder (smithy-lang#2310) * fn set_fields * add fn set_fields to fluent builder * better docs * fix * improve document cfg to Attribute class
* Rfc30/document (smithy-lang#2196) * impl/refactor documet * impl serde/desr for document * fix * add anchor end * precommit fix * Rfc30/cargo.toml update (smithy-lang#2180) * add serde under aws_sdk_unstable * changelog.next.toml * Apply suggestions from code review Co-authored-by: Julian Antonielli <[email protected]> Co-authored-by: Julian Antonielli <[email protected]> Co-authored-by: Zelda Hessler <[email protected]> * Rfc30/blob (smithy-lang#2181) * rfc30 blob * blob import fix add license header pre commit * change unstable keyword to aws_sdk_unstable * change unstable keyword to aws_sdk_unstable * add test * updater changelog * Update CHANGELOG.next.toml * Update lib.rs remove extra Document declaration from bad merge * remove/unused import Co-authored-by: Zelda Hessler <[email protected]> Co-authored-by: Zelda Hessler <[email protected]> * RFC30/datetime (smithy-lang#2184) * serde support for datetime with testing * add ciborium to cargo.toml * update changelog * refactor impl suggestions from * refacotring better err message * Revert "update changelog" This reverts commit d58abfa. * add/license header * add: license header * remove unnecessary returns Co-authored-by: Zelda Hessler <[email protected]> * fix: changelog entries * fix: some serde stuff broken by Zelda in the merges * Fix unused imports * Implement serde support for `aws_smithy_types::Number` (smithy-lang#2185) * add line (smithy-lang#2311) * RFC30/Set fields to fluent builder (smithy-lang#2310) * fn set_fields * add fn set_fields to fluent builder * better docs * fix * improve document cfg to Attribute class * Rfc30/feature gate for generated crates (smithy-lang#2183) * add CfgUnstable for feature-gate * add features * add feature-gate * strings for feature gate * Revert "strings for feature gate" This reverts commit 1f33a5c. * Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt Co-authored-by: Zelda Hessler <[email protected]> * fix dependency thing on cargo * add OutputShape to builder * EnumGenerator * StructureGenerator * UnionGenerator * todo * fixed? * SerdeDecorator * codegen stuff * update * fix * Apply suggestions from code review Co-authored-by: Zelda Hessler <[email protected]> * - refactoring - pre-commit - https://github.com/awslabs/smithy-rs/pull/2183/files#r1080594621 * adds serde-serialize/deserialize * this one causes null pointer exception * interim solution * new push * fix * add Sensitive Warning * add test for CargoTomlGeneratorTest pre-commit fix * Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt Co-authored-by: Zelda Hessler <[email protected]> --------- Co-authored-by: Zelda Hessler <[email protected]> * Upgrade the smithy-rs runtime crates version to 0.55.0 * Update changelog * merge * Revert "merge" This reverts commit 6f00505. * squash commit * update: gradle.properties --------- Co-authored-by: Julian Antonielli <[email protected]> Co-authored-by: Zelda Hessler <[email protected]> Co-authored-by: Zelda Hessler <[email protected]> Co-authored-by: John DiSanti <[email protected]> Co-authored-by: AWS SDK Rust Bot <[email protected]>
Motivation and Context
Part of RFC30
Description
Add
fn set_fields
to fluent builder.Testing
NA
Checklist
NA
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.