Validation trouble for nested

Related to this: Declarative Validation for nested collections?

I’ve created a minimal repo here: https://github.com/specimen151/ValidationTest

When I run the Locator with JSON:

{
    "site": "sdf","parameters":[{}]
}

I get the correct error message.

When I run the almost identical call ActivitiesToUnit4 (from SS /ui path) with JSON

{
"activitiesToUnit4":[{}]
}

I don’t get any errors, even though there are plenty of [ValidateNotEmpty] on public string properties.

Could you please take a look? I can paste more code here if necessary.

1 Like

I accidentally made a private repo but it’s public now.

Hi @specimen151,

Thanks for reporting the issue, and sharing a reproduction on GitHub! This issue should be resolved in this commit and is now available on our MyGet NuGet feed in v6.4.1. Ensure you clear your nuget packages using dotnet nuget locals all --clear if you are already using v6.4.1.

Thanks again!

1 Like

I can confirm that it works now.
Bugs happen unfortunately, but a fix “in my hands” within 10 hours, that is amazing. Thanks “Guybrush”.

Can I take the repo down? Don’t think it’s that interesting for future readers?

For future readers:
Summarized, I had [Validation...] attributes on my DTO, which had a List<SubDTO> where the SubDTO class also were using [Validation...] attributes.

The validation on the “child” class was not working. It was very hard to see, for the untrained eye.
Layoric commented this:

When parent IEnumerable property has its own declarative validation attributes, child attributes are skipped. This removes the check so that nested validation is also applied in this case by removing the existing rule check for a parent property validation.

1 Like