aboutsummaryrefslogtreecommitdiffstats
path: root/util/jsonschema.lua
Commit message (Collapse)AuthorAgeFilesLines
* util.jsonschema: Remove wrapper functionKim Alvefur2023-06-171-7/+0
| | | | This was to silence some Teal warning that seems to have gone away.
* util.jsonschema: Silence Teal warnings about utf8 libraryKim Alvefur2023-06-171-2/+2
| | | | | | Teal worries that we redefine the global. Also that the fallback was missing type information.
* util.jsonschema: Silence Teal warnings about counting items in tablesKim Alvefur2023-06-171-4/+4
| | | | | Teal thinks that these are key-value maps which are always of length zero, but that is not the case.
* util.jsonschema: Fix UTF-8ness of 'minLength' and 'maxLength'Kim Alvefur2023-04-231-2/+8
|
* util.jsonschema: Implement 'minContains' and 'maxContains'Kim Alvefur2023-04-231-4/+3
|
* util.jsonschema: Implement 'luaPattern' - Lua variant of 'pattern'Kim Alvefur2023-04-221-0/+3
| | | | | Like 'pattern' but uses Lua patterns instead of Regular Expressions, since only a subset of regex are also valid Lua patterns.
* util.jsonschema: Implement 'luaPatternProperties' as Lua variant of ↵Kim Alvefur2023-04-221-1/+18
| | | | | | | | 'patternProperties' Previous version of this patch used 'patternProperties' but that would only work with simpler ECMA-262 regular expressions are also valid Lua patterns.
* util.jsonschema: Implement 'dependentSchemas'Kim Alvefur2023-03-261-0/+8
| | | | | If this object key exists then this schema must validate against the current object. Seems useful.
* util.jsonschema: Implement 'dependentRequired'Kim Alvefur2023-03-261-0/+12
| | | | If this field exists, then these fields must also exist.
* util: Prefix module imports with prosody namespaceKim Alvefur2023-03-171-2/+2
|
* util.jsonschema: Use same integer/float logic on Lua 5.2 and 5.3Kim Alvefur2022-10-091-2/+2
| | | | | Fixes test case type.json:0:1 covering treatment of 1.0 as an integer according to the JSON definition
* util.jsonschema: Fix Lua 5.2 integer compatKim Alvefur2022-10-091-1/+1
| | | | | math.type() is unavailable before Lua 5.3 so this should use the compat function added at the top
* util.jsonschema: Fix validation to not assume presence of "type" fieldKim Alvefur2022-07-081-135/+141
| | | | | | | | | | | | | | | | | | | | | | MattJ reported a curious issue where validation did not work as expected. Primarily that the "type" field was expected to be mandatory, and thus leaving it out would result in no checks being performed. This was likely caused by misreading during initial development. Spent some time testing against https://github.com/json-schema-org/JSON-Schema-Test-Suite.git and discovered a multitude of issues, far too many to bother splitting into separate commits. More than half of them fail. Many because of features not implemented, which have been marked NYI. For example, some require deep comparisons e.g. when objects or arrays are present in enums fields. Some because of quirks with how Lua differs from JavaScript, e.g. no distinct array or object types. Tests involving fractional floating point numbers. We're definitely not going to follow references to remote resources. Or deal with UTF-16 sillyness. One test asserted that 1.0 is an integer, where Lua 5.3+ will disagree.
* util.jsonschema: Lua <5.3 compat here tooKim Alvefur2022-05-091-1/+4
|
* util.jsonschema: Add support for $ref pointersKim Alvefur2021-12-291-21/+33
|
* util.jsonschema: Rename types for improved readabilityKim Alvefur2021-03-181-3/+12
|
* util.jsonschema: Restructure "type" keyword handlingKim Alvefur2021-03-091-9/+10
| | | | More in line with the other tests
* util.jsonschema: Syntax tweak to not upset syntax highlightingKim Alvefur2021-03-091-2/+2
| | | | | That whole condition stanza was shown as angry red, I think it's something with 'enum' being a key word in Teal.
* util.jsonschema: Implement "propertyNames"Kim Alvefur2021-03-091-0/+6
| | | | This is a bit special in Lua as tables are not limited to string keys
* util.jsonschema: Restructure handling of "properties" and "additionalProperties"Kim Alvefur2021-03-091-22/+8
| | | | This is a bit cleaner, I think
* util.jsonschema: Fix "uniqueItems" prematurely declaring a matchKim Alvefur2021-03-091-1/+0
|
* util.jsonschema: Implement the "prefixItems" keywordKim Alvefur2021-03-091-1/+12
| | | | This may have been what got me confused about "items" being an array.
* util.jsonschema: Implement the "contains" keywordKim Alvefur2021-03-091-0/+13
| | | | And apparently I had mistaken this for an array
* util.jsonschema: Allow a boolean as schemaKim Alvefur2021-03-091-0/+3
| | | | | | Apparently a schema must be either an object or a boolean. Not sure where I got this string shortcut from, but I think I will keep it as it is very convenient.
* util.jsonschema: Correct "items" keywordKim Alvefur2021-03-091-12/+4
| | | | | | Upon re-reading the JSON Schema spec, I found that 'items' wasn't a union of an array of schemas or a single schema, not sure where I got that from.
* util.jsonschema: Library for JSON Schema validationKim Alvefur2021-03-061-0/+245