🔧 Fixers

EasyValidate Fixers

Automated code fixes for common validation patterns and issues with one-click solutions

10

Code Fixers

4

Categories

13

Analyzers Fixed

How Code Fixers Work

When the EasyValidate analyzer detects an issue in your code, VS Code (or Visual Studio) will show a lightbulb 💡 icon. Click it to see available quick fixes. These fixers automatically transform your code to follow best practices and resolve analyzer warnings/errors with a single click.

FIX001
EASY008EASY010
Chain Reordering
Automatically reorders validation attributes in a chain to ensure proper type flow. When attribute output types don't match the next attribute's input type, this fixer reorders them correctly.
Chain Validation

❌ Before

✅ After

FIX002
EASY011
Conditional Method Implementation
Generates the missing conditional method when ConditionalMethod is specified but the method doesn't exist. Creates a method with proper signature.
Conditional Validation

❌ Before

✅ After

FIX003
EASY015
Conditional Method Name
Fixes invalid conditional method names by correcting them to valid C# identifiers or using nameof() for compile-time safety.
Conditional Validation

❌ Before

✅ After

FIX004
EASY007
Duplicate Attribute in Chain
Resolves duplicate validation attributes in the same chain by either removing duplicates or assigning them to different chains.
Chain Validation

❌ Before

✅ After

FIX005
EASY016
Missing Types (IGenerate)
Adds the required IGenerate interface implementation when a class has validation attributes but doesn't implement IGenerate.
Setup

❌ Before

✅ After

FIX006
EASY009
NotNull Injection
Automatically injects NotNull attribute at the beginning of a validation chain when validating nullable types that need null checks.
Chain Validation

❌ Before

✅ After

FIX007
EASY018
Public Method Visibility
Changes public methods with validation attributes to internal or private to avoid confusion in validation processing.
Design

❌ Before

✅ After

FIX008
EASY002EASY003
Validation Attribute Usage
Fixes validation attribute implementations by adding proper AttributeUsage or ensuring correct interface implementation.
Design

❌ Before

✅ After

FIX009
EASY012EASY013
Conditional Method Parameter Fix
Fixes conditional method signatures by correcting the parameter type to IChainResult or adjusting parameter count.
Conditional Validation

❌ Before

✅ After

FIX010
EASY014
Conditional Method Return Type
Fixes conditional method return types to bool or ValueTask<bool> as required by the validation system.
Conditional Validation

❌ Before

✅ After

Analyzer Coverage

These analyzer error codes have automatic code fixes available:

EASY002EASY003EASY007EASY008EASY009EASY010EASY011EASY012EASY013EASY014EASY015EASY016EASY018