Skip to content

feat(codegen): include @deprecated message and since in generated JSDoc#1888

Open
TrevorBurnham wants to merge 1 commit intosmithy-lang:mainfrom
TrevorBurnham:fix/deprecated-jsdoc-message-since
Open

feat(codegen): include @deprecated message and since in generated JSDoc#1888
TrevorBurnham wants to merge 1 commit intosmithy-lang:mainfrom
TrevorBurnham:fix/deprecated-jsdoc-message-since

Conversation

@TrevorBurnham
Copy link
Contributor

Issue #, if available:

Fixes #1425

Description of changes:

The @deprecated trait in Smithy supports message and since fields, but the TypeScript codegen was only including message in the generated JSDoc and completely ignoring since. 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 buildDeprecationAnnotation helper to TypeScriptWriter that renders both fields into the JSDoc:

message only:    @deprecated Use FooV2 instead
since only:      @deprecated
                 @since 2024-01-01
both:            @deprecated Use FooV2 instead
                 @since 2024-01-01
neither:         @deprecated deprecated    (existing fallback behavior)

Updated all three sites that generate @deprecated annotations:

  • TypeScriptWriter.writeShapeDocs — shapes with a DocumentationTrait
  • TypeScriptWriter.writeMemberDocs — member shapes (including inherited deprecation from targets)
  • CommandGenerator — operations without a DocumentationTrait

Unit 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.

@TrevorBurnham TrevorBurnham requested a review from a team as a code owner February 21, 2026 23:07
@kuhe
Copy link
Contributor

kuhe commented Feb 24, 2026

@since is not a tsdoc annotation and would have to be synthesized into the deprecation message

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
@TrevorBurnham TrevorBurnham force-pushed the fix/deprecated-jsdoc-message-since branch from 0ba4a2d to dac15d9 Compare February 28, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@deprecated message and since in JSDoc

2 participants