ardalis / Result

A result abstraction that can be mapped to HTTP response codes if needed.
MIT License
866 stars 107 forks source link

Change ValidationErrors to Dictionary<string, string[]> #24

Closed pauldbentley closed 4 years ago

pauldbentley commented 4 years ago

Hi Steve,

This changes ValidationErrors to allow mutiple errors for the same key.

I wasn't sure how to update the Nuget links, so I have commented out the package references and just added in a project references. I presume this is something you can check and change?

Thanks

Paul

ardalis commented 4 years ago

It’s a two step process. You have to update and publish the base package then update to use it in the other one and deploy it. I’ll sort that part out. Thanks!

SimonGeering commented 4 years ago

This is a breaking change so at a minimum should have an appropriate major version bump since there has already been getting on for 200 downloads.

Maybe making it a param array or adding an overload to help with compatibility

ardalis commented 4 years ago

Good point; I'll get the versions sorted out as well (with version bumps).

SimonGeering commented 4 years ago

This is also something of interest in the context of what a validation result means. Something I have commented further on here: https://github.com/ardalis/Result/issues/16#issuecomment-630255263

ardalis commented 4 years ago

Thanks @pauldbentley - we ended up incorporating a lot of this into a couple of other recent PRs. Cheers!

pauldbentley commented 4 years ago

Thanks @ardalis - it's great to see this package developing.

FYI - I've been using my own package while this one evolves, my ultimate aim is to use your package.

I've got a few differences in-case they were useful:

This makes the code:

return Result<IEnumerable<WeatherForecast>>.NotFound();

Become:

return Result.NotFound<IEnumerable<WeatherForecast>>();