Skip to content

Conversation

@NeedleInAJayStack
Copy link
Contributor

This decodes the different OTel deprecation type options, and renders different Swift @available attributes based on that type. Specifically, renamed attributes get a renamed argument in the Swift attribute, and obsoleted get a prefix to their message. Non-labeled OTel deprecations are interpreted as uncategorized, which are translated to an ordinary Swift deprecation without a renamed section or message prefix.

It introduces tests to the Generator package, covering these particular decoding and generation paths.

This resolves #15

This decodes the different OTel deprecation type options, and renders different Swift deprecation attributes based on that type
@NeedleInAJayStack NeedleInAJayStack requested a review from a team as a code owner May 25, 2025 18:26
@NeedleInAJayStack NeedleInAJayStack requested review from slashmo and removed request for a team May 25, 2025 18:26
slashmo
slashmo previously approved these changes May 25, 2025
This adjusts the rename_to deprecation logic to correctly resolve Swift member names, while allowing different rendering type hierarchies, and namespace/property naming strategies. It does so by introducing an `attributeIdToSwiftMemberPath` requirement on the FileRenderer protocol, and using that protocol in the deprecation logic. Since this function typically requires walking the full namespace tree, a Context type was added to inject the namespace tree into the renderers for reference. Finally, the deprecation tests now require a fake namespace tree for renamed deprecation type resolution.

There were no changes to the current generated code-set resulting from these adjustments.
@NeedleInAJayStack NeedleInAJayStack force-pushed the feat/deprecation-attributes branch from 79a8b7e to 0dd164c Compare May 26, 2025 19:04
Copy link
Member

@slashmo slashmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Jay! I can see this leading to a really nice deprecation UX once we generate some renamed attributes too 🥳 And the way you implemented it should enable us to do the improved DocC references too 🙏

@NeedleInAJayStack
Copy link
Contributor Author

Great work Jay! I can see this leading to a really nice deprecation UX once we generate some renamed attributes too 🥳 And the way you implemented it should enable us to do the improved DocC references too 🙏

Thanks! Yeah, it'll be cool to have it be really smooth and usable. Thanks for the review!

@slashmo slashmo merged commit 798e674 into swift-otel:main May 26, 2025
5 checks passed
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.

Add new deprecated attribute support

2 participants