C#C
C#4y ago
barcode

Error validation [Answered]

   [Required]
    [MinLength(8, ErrorMessage = "Password too short")]
    [MaxLength(32, ErrorMessage ="Password too long")]
    public string Password { get; set; }


I have this in my Dto and when validation is invalid I get this for example

{
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "traceId": "00-7e6431d39d15726ab988a4d46bcfec16-79d8864992a8a975-00",
    "errors": {
        "Password": [
            "Password too short"
        ]
    }
}
Was this page helpful?