karenetheridge / JSON-Schema-Modern

Validate data against a schema using a JSON Schema
https://metacpan.org/release/JSON-Schema-Modern/
Other
10 stars 1 forks source link

vocabulary extension: keywords relating to string sorting #40

Open karenetheridge opened 3 years ago

karenetheridge commented 3 years ago

(yes, some keyword names overlap with the "validation" vocabulary; this should be okay as we can infer the vocabulary based on instance and keyword data type. That is, if both vocabularies are in use, both vocabularies will look at these keywords and attempt to evaluate them, but the vocabulary(ies) with the mismatched data type(s) will do nothing.)

When considering string ordering, we do NOT use the unicode codepoint order, but rather we respect the sorting and collation semantics of the stated locale -- see https://www.unicode.org/reports/tr10/. case-sensitive sorting will use Unicode Collation Level 4. case-insensitive sorting will use Unicode Collation Level 2.

karenetheridge commented 3 years ago

xrefs:

https://github.com/json-schema-org/json-schema-vocabularies/issues/21 https://github.com/json-schema-org/json-schema-vocabularies/issues/7

karenetheridge commented 2 years ago

I would love to be able to have the existing maximum, minimum keywords support strings, but there is the question of what to do about non-ascii characters. We could simply say that all non-ascii characters would be replaced by 0x80 for the purpose of string comparisons, so that all non-ascii characters are "greater" than ascii characters, and all non-ascii characters are equivalent to each other.