feat(codegen): include @deprecated message and since in generated JSDoc#1888
Open
TrevorBurnham wants to merge 1 commit intosmithy-lang:mainfrom
Open
feat(codegen): include @deprecated message and since in generated JSDoc#1888TrevorBurnham wants to merge 1 commit intosmithy-lang:mainfrom
TrevorBurnham wants to merge 1 commit intosmithy-lang:mainfrom
Conversation
Contributor
|
|
The @deprecated trait supports message and since fields, but the TypeScript codegen only included the message in the generated JSDoc annotation and completely ignored the since field. Adds a buildDeprecationAnnotation helper to TypeScriptWriter that renders both fields: - message only: @deprecated Use FooV2 instead - since only: @deprecated\n@since 2024-01-01 - both: @deprecated Use FooV2 instead\n@since 2024-01-01 - neither: @deprecated deprecated (existing fallback) Updated all three sites that generate @deprecated annotations: - TypeScriptWriter.writeShapeDocs (shapes with documentation) - TypeScriptWriter.writeMemberDocs (member shapes) - CommandGenerator (operations without documentation) Fixes smithy-lang#1425
0ba4a2d to
dac15d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Fixes #1425
Description of changes:
The
@deprecatedtrait in Smithy supportsmessageandsincefields, but the TypeScript codegen was only includingmessagein the generated JSDoc and completely ignoringsince. This meant useful context like "Use FooV2 instead" or "deprecated since 2024-01-01" was lost in the generated client code.This PR adds a
buildDeprecationAnnotationhelper toTypeScriptWriterthat renders both fields into the JSDoc:Updated all three sites that generate
@deprecatedannotations:TypeScriptWriter.writeShapeDocs— shapes with aDocumentationTraitTypeScriptWriter.writeMemberDocs— member shapes (including inherited deprecation from targets)CommandGenerator— operations without aDocumentationTraitUnit tests added for all four field combinations (message only, since only, both, neither).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.