Skip to content

Validation of Pattern for Date Datatype is not working #1667

@lovinjv

Description

@lovinjv

We are migrating our spring boot application to java 17 . We are using jsonschema2pojo (v1.1.3) . We have a Date attribute with a pattern defined to validate (yyyy-mm-dd) values . The validation works fine in java 11 with javax.validation.constraints.Pattern, where the request is stopped with a Pattern check if the values does'not match .
But with java 17 and jakarta.validation.constraints.Pattern, the pattern check is not happening.

Sample json code:

{
  "updatedDate": {
    "type": "string",
    "format" : "date",
    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
  }
}

Note - It is a mandatory parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions