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 Validation Method code fix doesn't account for body-less declarations #742

Open
SteveDunn opened this issue Jan 23, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@SteveDunn
Copy link
Owner

Describe the bug

Given:
public partial readonly struct RedemptionId;, when I alt+enter and do 'Add Validation Method', I get:

[ValueObject<string>]
public readonly partial struct RedemptionId private static Validation Validate(string input)
{
    bool isValid = true; // todo: your validation
    return isValid ? Validation.Ok : Validation.Invalid("[todo: describe the validation]");
};

Steps to reproduce

Given:
public partial readonly struct RedemptionId;, when I alt+enter and do 'Add Validation Method', I get:

[ValueObject<string>]
public readonly partial struct RedemptionId private static Validation Validate(string input)
{
    bool isValid = true; // todo: your validation
    return isValid ? Validation.Ok : Validation.Invalid("[todo: describe the validation]");
};

Expected behaviour

I should get:

[ValueObject<string>]
public readonly partial struct RedemptionId
{
    private static Validation Validate(string input)
    {
        bool isValid = true; // todo: your validation
        return isValid ? Validation.Ok : Validation.Invalid("[todo: describe the validation]");
    }
}
@SteveDunn SteveDunn added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant