aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/util_jsonschema_spec.lua20
-rw-r--r--util/jsonschema.lua6
2 files changed, 16 insertions, 10 deletions
diff --git a/spec/util_jsonschema_spec.lua b/spec/util_jsonschema_spec.lua
index 74da2c07..968acaf1 100644
--- a/spec/util_jsonschema_spec.lua
+++ b/spec/util_jsonschema_spec.lua
@@ -8,10 +8,6 @@ if lfs.attributes(test_suite_dir, "mode") ~= "directory" then return end
-- Tests to skip and short reason why (NYI = not yet implemented)
local skip = {
- ["ref.json:0:3"] = "NYI additionalProperties";
- ["ref.json:3:2"] = "FIXME investigate, util.jsonpath issue?",
- ["ref.json:6:1"] = "NYI",
- ["required.json:0:2"] = "distinguishing objects from arrays",
["additionalProperties.json:0:2"] = "distinguishing objects from arrays",
["additionalProperties.json:0:5"] = "NYI",
["additionalProperties.json:1:0"] = "NYI",
@@ -40,16 +36,26 @@ local skip = {
["patternProperties.json"] = "NYI",
["properties.json:1:2"] = "NYI",
["properties.json:1:3"] = "NYI",
+ ["ref.json:0:3"] = "NYI additionalProperties",
+ ["ref.json:11"] = "NYI",
+ ["ref.json:12:1"] = "FIXME",
+ ["ref.json:13"] = "NYI",
["ref.json:14"] = "NYI",
["ref.json:15"] = "NYI",
["ref.json:16"] = "NYI",
["ref.json:17"] = "NYI",
["ref.json:18"] = "NYI",
- ["ref.json:13"] = "NYI",
["ref.json:19"] = "NYI",
- ["ref.json:11"] = "NYI",
- ["ref.json:12:1"] = "FIXME",
+ ["ref.json:26"] = "NYI",
+ ["ref.json:27"] = "NYI",
+ ["ref.json:28"] = "NYI",
+ ["ref.json:3:2"] = "FIXME investigate, util.jsonpath issue?",
+ ["required.json:4"] = "JavaScript specific and distinguishing objects from arrays",
+ ["ref.json:6:1"] = "NYI",
+ ["ref.json:20"] = "NYI",
+ ["ref.json:25"] = "NYI",
["refRemote.json"] = "DEFINITELY NYI",
+ ["required.json:0:2"] = "distinguishing objects from arrays",
["type.json:3:4"] = "distinguishing objects from arrays",
["type.json:3:6"] = "null is weird",
["type.json:4:3"] = "distinguishing objects from arrays",
diff --git a/util/jsonschema.lua b/util/jsonschema.lua
index 48a3351f..eafa8b7c 100644
--- a/util/jsonschema.lua
+++ b/util/jsonschema.lua
@@ -1,7 +1,7 @@
-- This file is generated from teal-src/util/jsonschema.lua
-local m_type = math.type or function (n)
- return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
+local m_type = function(n)
+ return type(n) == "number" and n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
end;
local json = require("util.json")
local null = json.null;
@@ -81,7 +81,7 @@ function complex_validate(schema, data, root)
if type(data) == "table" then
for i in pairs(data) do
- if not (math.type(i) == "integer") then
+ if not (m_type(i) == "integer") then
return false
end
end