Skip to content

Validation order: elements go first and collection itself goes second #178

@abatishchev

Description

@abatishchev

Hi, I have a web api accepting a collection of elements both having validator:

public IHttpActionResult PostData(PaymentCollection payments)
{
}

[Validator(typeof(PaymentCollectionValidator))]
public class PaymentCollection : Collection<Payment>
{
}

[Validator(typeof(PaymentValidator))]
public class Payment
{
}

I want to check the collection for length and its elements for validity.

But whrn I make a request, elements go first and collection itself goes second in the validation order even collection is invalid (has too many elements, for instance) so validation is guaranteed to fail.

How can I change the order?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions