This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ModelState errors are wrong when using attributes like [FromHeader] #1681
Comments
Analysis suggests this is an undocumented issue from WSR webapi (which this code is based upon). See
We encounter this issue because our 'greedy' model binders return true to halt the binding process. This is interpreted as a successful bind, and so validation runs. This has the effect of giving attributes like |
rynowak
added a commit
that referenced
this issue
Dec 9, 2014
…omHeader] The issue here is that a model state error is added with the model name 'doubled'. This is on a fairly obscure code path and the code dates back to the original WSR git checkin of webapi. There are no wsr tests that verify this behavior. The cause here is that our 'greedy' model binders (like FromHeaderModelBinder) return 'true' whether or not they successfully found a model, because they don't want other model binders to run. This also has an effect on the validation system. That means that validators will run and attempt to validate the model (which may be null). That's that rare case where we get to this code path.
rynowak
added a commit
that referenced
this issue
Dec 9, 2014
…omHeader] The issue here is that a model state error is added with the model name 'doubled'. This is on a fairly obscure code path and the code dates back to the original WSR git checkin of webapi. There are no wsr tests that verify this behavior. The cause here is that our 'greedy' model binders (like FromHeaderModelBinder) return 'true' whether or not they successfully found a model, because they don't want other model binders to run. This also has an effect on the validation system. That means that validators will run and attempt to validate the model (which may be null). That's that rare case where we get to this code path.
rynowak
added a commit
that referenced
this issue
Dec 9, 2014
…omHeader] The issue here is that a model state error is added with the model name 'doubled'. This is on a fairly obscure code path and the code dates back to the original WSR git checkin of webapi. There are no wsr tests that verify this behavior. The cause here is that our 'greedy' model binders (like FromHeaderModelBinder) return 'true' whether or not they successfully found a model, because they don't want other model binders to run. This also has an effect on the validation system. That means that validators will run and attempt to validate the model (which may be null). That's that rare case where we get to this code path.
rynowak
added a commit
that referenced
this issue
Dec 10, 2014
…omHeader] The issue here is that a model state error is added with the model name 'doubled'. This is on a fairly obscure code path and the code dates back to the original WSR git checkin of webapi. There are no wsr tests that verify this behavior. The cause here is that our 'greedy' model binders (like FromHeaderModelBinder) return 'true' whether or not they successfully found a model, because they don't want other model binders to run. This also has an effect on the validation system. That means that validators will run and attempt to validate the model (which may be null). That's that rare case where we get to this code path.
rynowak
added a commit
that referenced
this issue
Dec 10, 2014
…omHeader] The issue here is that a model state error is added with the model name 'doubled'. This is on a fairly obscure code path and the code dates back to the original WSR git checkin of webapi. There are no wsr tests that verify this behavior. The cause here is that our 'greedy' model binders (like FromHeaderModelBinder) return 'true' whether or not they successfully found a model, because they don't want other model binders to run. This also has an effect on the validation system. That means that validators will run and attempt to validate the model (which may be null). That's that rare case where we get to this code path.
Fixed in release 1631ca1 |
rynowak
added a commit
that referenced
this issue
Dec 10, 2014
…omHeader] The issue here is that a model state error is added with the model name 'doubled'. This is on a fairly obscure code path and the code dates back to the original WSR git checkin of webapi. There are no wsr tests that verify this behavior. The cause here is that our 'greedy' model binders (like FromHeaderModelBinder) return 'true' whether or not they successfully found a model, because they don't want other model binders to run. This also has an effect on the validation system. That means that validators will run and attempt to validate the model (which may be null). That's that rare case where we get to this code path.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In this case the model state error has the wrong key when no value is supplied:
The error should have key
transactionId
, but it'stransactionId.transactionId
The text was updated successfully, but these errors were encountered: