diff options
-rw-r--r-- | teal-src/util/jsonschema.tl | 5 | ||||
-rw-r--r-- | util/jsonschema.lua | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/teal-src/util/jsonschema.tl b/teal-src/util/jsonschema.tl index c6347de6..d2390f7e 100644 --- a/teal-src/util/jsonschema.tl +++ b/teal-src/util/jsonschema.tl @@ -136,7 +136,10 @@ end type_validators.integer = type_validators.number -local function validate(schema : schema_t | type_e, data : any) : boolean +local function validate(schema : schema_t | type_e | boolean, data : any) : boolean + if schema is boolean then + return schema + end if schema is type_e then return simple_validate(schema, data) end diff --git a/util/jsonschema.lua b/util/jsonschema.lua index 23a47bd7..b285feb4 100644 --- a/util/jsonschema.lua +++ b/util/jsonschema.lua @@ -57,6 +57,9 @@ end type_validators.integer = type_validators.number local function validate(schema, data) + if type(schema) == "boolean" then + return schema + end if type(schema) == "string" then return simple_validate(schema, data) end |