changeset 13879:88a5cb5a1ab5

util.datamapper: Fix some Teal warnings
author Kim Alvefur <zash@zash.se>
date Fri, 09 May 2025 00:47:19 +0200
parents 9ec961173b1c
children 9e36180e1528
files teal-src/prosody/util/datamapper.tl
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/prosody/util/datamapper.tl	Fri May 09 00:30:32 2025 +0200
+++ b/teal-src/prosody/util/datamapper.tl	Fri May 09 00:47:19 2025 +0200
@@ -25,7 +25,7 @@
 local json = require "prosody.util.json"
 local pointer = require "prosody.util.jsonpointer";
 
-local json_type_name = json.json_type_name;
+local type json_type_name = json.json_type_name;
 local json_schema_object = require "prosody.util.jsonschema"
 local type schema_t = boolean | json_schema_object
 
@@ -95,8 +95,6 @@
 
 	if propschema is json_schema_object then
 		proptype = guess_schema_type(propschema);
-	elseif propschema is string then -- Teal says this can never be a string, but it could before so best be sure
-		error("schema as string is not supported: "..propschema.." {"..current_ns.."}"..propname)
 	end
 
 	if proptype == "object" or proptype == "array" then
@@ -269,7 +267,7 @@
 		return  v
 	elseif proptype == "number" and v is number then
 		return  string.format("%g", v)
-	elseif proptype == "integer" and v is number then -- TODO is integer
+	elseif proptype == "integer" and v is integer then
 		return  string.format("%d", v)
 	elseif proptype == "boolean" then
 		return  v and "1" or "0"