-
Notifications
You must be signed in to change notification settings - Fork 195
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/feature gate for generated crates #2183
Rfc30/feature gate for generated crates #2183
Conversation
...main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/CargoTomlGenerator.kt
Outdated
Show resolved
Hide resolved
* commit RFC * commit * Delete rfc0023_serialization_and_deserialization.md * fix formatting * #1944 (comment) * #1944 (comment) * applied grammarly pre-commit * better example wip * FIX * #1944 (comment) #1944 (comment) #1944 (comment) * add examples for output's builer * fixes * fixing unstable feature gate snippet * Update rfc0028_serialization_and_deserialization.md Section is deleted in response to the discussion #1944 (comment) * file name fix * Update rfc0030_serialization_and_deserialization.md #2183 (comment) * Update rfc0030_serialization_and_deserialization.md
...en-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt
Show resolved
Hide resolved
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt
Outdated
Show resolved
Hide resolved
…en/core/smithy/RuntimeType.kt Co-authored-by: Zelda Hessler <[email protected]>
Your comment mentions
But there What am I missing? |
If you search for |
Thanks it seems to be working now. No idea why to be honest because the compiler was complaining to me that there is no |
There are still things that I haven't figured out so I think I need more time. |
* commit RFC * commit * Delete rfc0023_serialization_and_deserialization.md * fix formatting * smithy-lang/smithy-rs#1944 (comment) * smithy-lang/smithy-rs#1944 (comment) * applied grammarly pre-commit * better example wip * FIX * smithy-lang/smithy-rs#1944 (comment) smithy-lang/smithy-rs#1944 (comment) smithy-lang/smithy-rs#1944 (comment) * add examples for output's builer * fixes * fixing unstable feature gate snippet * Update rfc0028_serialization_and_deserialization.md Section is deleted in response to the discussion smithy-lang/smithy-rs#1944 (comment) * file name fix * Update rfc0030_serialization_and_deserialization.md smithy-lang/smithy-rs#2183 (comment) * Update rfc0030_serialization_and_deserialization.md
I think it's ready for reviews! |
Current implementation adds But, it would be nice if you could check the other things. |
Ok, so thanks to NPE the piece of code doesn't work for some reason. No idea why. I decided to replace it with a string for a time being to move forward with testing other todos ... etc. |
pre-commit fix
Import errors are handled here #2185. |
I think I messed it up. Let me fix it. |
c6b0676
to
a5970c0
Compare
@jdisanti |
@Velfi |
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.
For the most part, this is good. I only see a few things that need updating and then we can merge it.
...c/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt
Outdated
Show resolved
Hide resolved
public fun SerdeSerialize(): Attribute { | ||
return Attribute(cfgAttr(all(writable("aws_sdk_unstable"), feature("serde-serialize")), derive(RuntimeType.SerdeSerialize))) | ||
} | ||
public fun SerdeDeserialize(): Attribute { | ||
return Attribute(cfgAttr(all(writable("aws_sdk_unstable"), feature("serde-deserialize")), derive(RuntimeType.SerdeDeserialize))) | ||
} |
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.
There's no need for these to be functions. Change them into values and put them in the companion object below.
public fun SerdeSerialize(): Attribute { | |
return Attribute(cfgAttr(all(writable("aws_sdk_unstable"), feature("serde-serialize")), derive(RuntimeType.SerdeSerialize))) | |
} | |
public fun SerdeDeserialize(): Attribute { | |
return Attribute(cfgAttr(all(writable("aws_sdk_unstable"), feature("serde-deserialize")), derive(RuntimeType.SerdeDeserialize))) | |
} | |
val SerdeSerialize = Attribute(cfgAttr(all(writable("aws_sdk_unstable"), feature("serde-serialize")), derive(RuntimeType.SerdeSerialize))) | |
val SerdeDeserialize = Attribute(cfgAttr(all(writable("aws_sdk_unstable"), feature("serde-deserialize")), derive(RuntimeType.SerdeDeserialize))) |
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.
This causes NPE too.
Attribute("").SerdeSerialize().render(writer) | ||
Attribute("").SerdeDeserialize().render(writer) |
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.
After making the change suggested in my earlier comment, you can update this function like so:
Attribute("").SerdeSerialize().render(writer) | |
Attribute("").SerdeDeserialize().render(writer) | |
Attribute.SerdeSerialize.render(writer) | |
Attribute.SerdeDeserialize.render(writer) |
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.
No, this causes NPE.
Here is the discussion.
…en/core/smithy/generators/BuilderGenerator.kt Co-authored-by: Zelda Hessler <[email protected]>
I left some comments. I don't want to rush you, but I really appreciate if you could take a look at it. |
Hi, Would you kindly give me some replies to my comment? |
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.
@thomas-k-cameron Sorry about the wait on this one. I'll put it in the merge queue
No problem! |
* 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
serde::Serialize/Deserialize
toRuntimeType.kt
add
CfgUnstable
onDependencyScope
add
serde::Serialize/Deserialize
trait to generated data typesTesting
NA
Checklist
TODO
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.