Skip to content

Validate model state not working? #411

Closed
@wayne-o

Description

@wayne-o

Description

I am trying to use #316 by adding this to my Models:

 [Required(AllowEmptyStrings=false)] 
[StringLength(30, MinimumLength = 5, ErrorMessage = "Invalid - Name needs to be at least 5 characters long")]

And this in my startup:

 services.AddMvcCore()
                .AddDataAnnotations()

But it seems to completely ignore it -is there anything else I need to do to get this to work?

...

Environment

  • JsonApiDotNetCore Version: latest stable (v2.5.2)
  • Other Relevant Package Versions:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions