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

Add custom attributes #22

Open
tranb3r opened this issue Dec 14, 2023 · 1 comment
Open

Add custom attributes #22

tranb3r opened this issue Dec 14, 2023 · 1 comment

Comments

@tranb3r
Copy link

tranb3r commented Dec 14, 2023

In some cases, it might be useful to have some custom attributes over the generated properties.

[AutoBindable]
[property: JsonRequired]
[property: JsonPropertyName("name")]
private readonly string? _username;

This would generate a Username property, with those two [JsonRequired] and [JsonPropertyName("name")] attributes over it.

For information, this feature is already supported by CommunityToolkit.Mvvm in its ObservableProperty source generator.
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/generators/observableproperty#adding-custom-attributes

I think it would be a great addition to BindableProperty source generator.

@rrmanzano
Copy link
Owner

Hi @tranb3r totally agree, that implementation is on my to-do list. I am working on an internal refactor to use "SyntaxFactory" instead of "String building". This change will not affect the final result or how it should be implemented, but this is important to be able to add this new feature

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

No branches or pull requests

2 participants