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

[Bug] validating collection elements #142

Open
GioviQ opened this issue Jun 9, 2022 · 6 comments
Open

[Bug] validating collection elements #142

GioviQ opened this issue Jun 9, 2022 · 6 comments
Labels
Bug Something isn't working Triage Issue needs to be triaged

Comments

@GioviQ
Copy link
Contributor

GioviQ commented Jun 9, 2022

I have the following validator:

 public class CustomerValidator : AbstractValidator<Customer> 
 {
   public CustomerValidator() 
   {
     RuleForEach(x => x.Orders).SetValidator(new OrderValidator());
   }
 }

Orders is of type
https://github.com/Breeze/breeze.sharp/blob/master/Breeze.Sharp/INavigationSet.cs#L60

This line https://github.com/Blazored/FluentValidation/blob/main/src/Blazored.FluentValidation/EditContextFluentValidationExtensions.cs#L171 gives Ambiguos Match Exception

The escamotage is creating and using a derived property like List<Order> OrderList { get => Orders.ToList() } , but I would like not to use it.

@GioviQ GioviQ added Bug Something isn't working Triage Issue needs to be triaged labels Jun 9, 2022
@Sharaf-Mansour
Copy link

Sharaf-Mansour commented Jun 9, 2022

@GioviQ Can you provide a minimal repo to test this implementation and share more details about the Exception?

@GioviQ
Copy link
Contributor Author

GioviQ commented Jun 9, 2022

@Sharaf-Mansour I think it is very clear that item property is not found, have you click on the link pointing to the exact line of code where the issue is?

@Sharaf-Mansour
Copy link

Sharaf-Mansour commented Jun 9, 2022

@GioviQ Yes I have seen it, but it says
This code assumes C# conventions (one indexer named Item with one param)
and if it is not found it will return null which is checked in the line after.
I needed more details like the exception msg and mini repo to interstage the issue further so I can assist.

GioviQ added a commit to BlazorQ/FluentValidation that referenced this issue Jun 10, 2022
@GioviQ
Copy link
Contributor Author

GioviQ commented Jun 10, 2022

@Sharaf-Mansour see my PR

@Liero
Copy link

Liero commented Jul 5, 2022

@GioviQ: Ideally you replicate the issue online here: https://www.telerik.com/blazor-ui/repl, so the the maintainers does not have to spent time replicating the issue.

In your particular case, it seems, the the bug is related to code you haven't posted anywhere (NotifiableCollection.cs probably?).

Anyway, I think your PR does not solve the source of the issue, see my comment

@GioviQ
Copy link
Contributor Author

GioviQ commented Jul 5, 2022

The PR has been tested with https://github.com/enkodellc/blazorboilerplate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants