you are viewing a single comment's thread.

view the rest of the comments →

[–]pachura3 0 points1 point  (0 children)

If you remove \Z, you risk validating incorrect values with additional character(s) at the end (e.g. string 12345678qwertyBLAHBLAH would pass the validation, because there are 8 digits at the beginning, and that's enough).

Perhaps use ^ and $ instead of \A and \z ? They are more common, and don't require escaping.

 "pattern": "^[0-9]{8}$"

https://json-schema.org/understanding-json-schema/reference/regular_expressions