Skip to content

Validation large number of elements #1235

Closed Answered by louthy
ipostanogov asked this question in Q&A
Discussion options

You must be logged in to vote

The thing to remember is that Validation is composable. So, you can work with smaller chunks and compose into bigger chunks:

public record Model1(string W);
public record Model2(string X);
public record Model3(string Y);
public record Model4(string Z);
public record Config(Model1 W, Model2 X, Model3 Y, Model4 Z);

public static class ValidateMany
{
    public static Validation<string, Model1> ValidateModel1 =>
        ...;
        
    public static Validation<string, Model2> ValidateModel2 =>
        ...;
        
    public static Validation<string, Model3> ValidateModel3 =>
        ...;
        
    public static Validation<string, Model4> ValidateModel4 =>
        ...;

    public static

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ipostanogov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants