Skip to content

custom message from schema doesn't work for date format #627

@andrew-lazovik

Description

@andrew-lazovik

The custom message doesn't work for the date format
for example, json-schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "value": {
      "type": "string",
      "format": "date"
    }
  },
 "message": {
    "format": "Keep date format yyyy-mm-dd"
  },
  "required": [
    "value"
  ]
}

invalid json

{
    "value": "2022-07-33"
}

after validation, I get the error message from the library:
$.value: 2022-07-33 is an invalid date

How can I create a custom error message from the schema for date format?

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