This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Validation occurs against declared type rather than real type #7952
Closed
Description
Is this a Bug or Feature request?:
Bug - Probably regression
Steps to reproduce (preferably a link to a GitHub repo with a repro project):
Repo with example project on: https://github.com/Materix/ValidationInterface
Send POST request on api/fruit
with {"type":"orange"}
as body and Content-Type: application/json
Expected result: ModelState.IsValid = false
Result: ModelState.IsValid = true
CompatibilityVersion is set to Version_2_1.
Without setting all works correctly
On 2.0.0. all works correctly.
Description of the problem:
I have interface of model class (IFruit
) from which two class derived (Apple
, Orange
). I have custom JsonConventer which determine proper type bases on one value from json. All validation attributes were in individual implementation. When I bind to IFruit
ModelState.IsValid always returns true.