Frage

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.

War es hilfreich?

Lösung

In the schema specification, here: http://json-schema.org/latest/json-schema-validation.html#anchor25, it specifies that maxLength is counting characters, not bytes.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top