-
Notifications
You must be signed in to change notification settings - Fork 190
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
Basic support of @deprecated trait in Smithy model #1570
Conversation
c6540f0
to
1ea10f8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
We should warn, not error out, on deprecated |
Reasonable to me. However, |
We are on 1.58 and we always remain behind in terms of Rust versions. Let's allow it and add a note to remove it when possible |
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.
We need to add a changelog entry for this PR.
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustTypes.kt
Outdated
Show resolved
Hide resolved
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustTypes.kt
Outdated
Show resolved
Hide resolved
...ware/amazon/smithy/rust/codegen/server/smithy/generators/ServerCombinedErrorGeneratorTest.kt
Outdated
Show resolved
Hide resolved
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustWriter.kt
Outdated
Show resolved
Hide resolved
3cdd51c
to
4061a1c
Compare
4061a1c
to
beca03b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustTypes.kt
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
* `Attribute.Custom.deprecated` is the main logic for building up `#[deprecated]` attribute * `RustWriter.deprecatedShape` is the counterpart of `documentShape`, but we do not going to generalize it as what `documentShape` does. Deprecated is only for Rust code and probably won't be used in other output language. Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
Signed-off-by: Weihang Lo <[email protected]>
e78a7f1
to
3006aac
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
LGTM!
This comment was marked as outdated.
This comment was marked as outdated.
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
#356
Basic support of [@deprecated] trait in Smithy model.
Description
Same feature parity between Smithy and Rust
The feature parity of
@deprecated
trait in Smithy model is exact the same as#[deprecated]
attribute in Rust. Both have a since field to indicate when it has been deprecated, with an additional note/message field.Service shapes are not supported
This patch mostly takes the implementation of documentation trait as a reference. Everywhere
documentShape
being called would get its counterpart ofdeprecatedShape
, which is in exact our implementation of generating#[deprecated]
attribute from@deprecated
trait.As a result, some important shapes haven't yet got support with documentation trait are also not going to get
@deprecated
feature. Namely, service, resource, and operation trait are not supported.Support
deprecated
property in@enum
traitThe other feature that is not actually a
@deprecated
trait but would start generating#[deprecated]
attribute is@enum
trait, which has an optionaldeprecated
property is the same as deprecated trait in terms of functionality. This part resides in EnumGenerator.kt.Testing
The simplest test is play around with
@deprecated
trait with different models.