In the schema specification, here: http://json-schema.org/latest/json-schema-validation.html#anchor25, it specifies that maxLength is counting characters, not bytes.
Are JSON Schema strings measured in bytes or characters?
-
21-09-2022 - |
Question
In my JSON schema I want to specify that a string can't be longer than a certain amount so that I am sure that the values are not too large to fit into my database. So, I can use the maxLength keyword for this. But, is it measuring the number of characters in the string or the number of bytes? If I have unicode strings where multiple bytes can be used for a single character this can make a very real difference for how long a string I can fit in my database.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow