Skip to content

Instantly share code, notes, and snippets.

@explorer14
Created March 3, 2019 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save explorer14/61885adfa759858af3eee4bcbf9188a2 to your computer and use it in GitHub Desktop.
Save explorer14/61885adfa759858af3eee4bcbf9188a2 to your computer and use it in GitHub Desktop.
public class ValidationProblemDetails : ProblemDetails
{
public ValidationProblemDetails() : base()
{
}
public ValidationProblemDetails(
ModelStateDictionary modelStateDictionary)
: base()
{
this.Errors = modelStateDictionary
.ToDictionary(x => x.Key,
y => y.Value.Errors.Select(
z => z.Exception.Details()).ToArray());
}
[JsonProperty(PropertyName = "errors")]
public IDictionary<string, string[]> Errors { get; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment