Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

IFormFile model binder suppressing validation for any non-null result. #4329

Closed
WillRay opened this issue Mar 22, 2016 · 4 comments
Closed
Assignees
Milestone

Comments

@WillRay
Copy link

WillRay commented Mar 22, 2016

The FormFileModelBinder suppresses any further validation if a value is found. This can result in some confusion (example) because any validation attributes attached to a property that is an IFormFile or collection of IFormFiles will not be invoked if any files actually exist.

Is this suppression necessary?

@danroth27
Copy link
Member

@rynowak Looks the suppression was deliberate. Do you remember why the suppression was added? Would it make sense to support [Required] on an IFormFile property?

@rynowak
Copy link
Member

rynowak commented Mar 22, 2016

Yeah, this was deliberate, and I think we just got this wrong. What we should be doing is setting ModelMetadata.ValidateChildren to false for this type, and but not suppressing validation of the node.

@Eilon Eilon added this to the 1.0.0 milestone Mar 22, 2016
@Eilon
Copy link
Member

Eilon commented Mar 22, 2016

Ok let's fix in RTM then.

@rynowak
Copy link
Member

rynowak commented Mar 30, 2016

e1abb47

@rynowak rynowak closed this as completed Mar 30, 2016
@rynowak rynowak modified the milestones: 1.0.0-rc2, 1.0.0 Mar 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants