Skip to content
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

Allow specifying a custom WIT type name when deriving WitType #3069

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jvff
Copy link
Contributor

@jvff jvff commented Dec 21, 2024

Motivation

The WitType trait allows generating WIT snippets. The WIT type name used is by default the kebab-case version of the Rust type name. However, it is sometimes necessary or desirable to use a custom name in the WIT snippet.

Proposal

Add a #[witty(name = "custom-wit-type-name")] attribute to allow overriding the default WIT type name.

Test Plan

A unit test was added to test the usage of the new attribute.

Release Plan

  • These changes follow the usual release cycle, as it introduces a new backwards compatible Witty feature.

Links

jvff added 3 commits December 21, 2024 15:26
Obtain the WIT type name using either a custom attribute or by
converting the Rust type name to kebab-case.
Allow specifying the WIT type name when deriving `WitType`.
Ensure that the `#[witty(name = "...")]` attribute can be used to
specify a custom WIT type name.
@jvff jvff added the enhancement New feature or request label Dec 21, 2024
@jvff jvff added this to the Testnet #2 milestone Dec 21, 2024
@jvff jvff requested review from Twey and ma2bd December 21, 2024 15:52
@jvff jvff self-assigned this Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow customizing the name of the generated WIT type
1 participant