tamaramata / solrnet

Automatically exported from code.google.com/p/solrnet
0 stars 0 forks source link

IMappingValidator does not catch multivalue/singlevalue mismatch #181

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If I call IMappingValidator.EnumerateValidationResults when I have a solr 
schema with a single valued field, but defined as ICollection in the C# class, 
then I would have expected an error or warning, but it doesn't show.

The cause seems to be that MultivaluedMappedToCollectionRule is not added to 
the DI container.

Can the MultivaluedMappedToCollectionRule be added as a default rule? Maybe 
emitting Warning instead of Errors (if you want to be backwards compatible).
In my own validation code I manually add the rule to the container so that the 
MappingValidator can get it injected. If that's the way to do it, then maybe 
adding a snippet to the MappingValidation wiki might help as well.

Original issue reported on code.google.com by rjvdb...@gmail.com on 4 Jun 2012 at 7:25

GoogleCodeExporter commented 8 years ago
Not sure why I didn't include it when it was implemented. I probably wanted to 
play it safe and make sure I wasn't reporting invalid mapping errors. Anyway, I 
just added it in 
https://github.com/mausch/SolrNet/commit/c7a980b4d26092cbbe2a44b3ffbff92e8c31dfb
a

Original comment by mauricio...@gmail.com on 25 Jul 2012 at 3:50