teal-src/prosody/util/jsonschema.tl
changeset 13089 0e17cb78264f
parent 13088 87f646e353cf
child 13090 42ea593bfa8d
equal deleted inserted replaced
13088:87f646e353cf 13089:0e17cb78264f
    96 	-- semantic format
    96 	-- semantic format
    97 	format : string
    97 	format : string
    98 
    98 
    99 	-- for Lua
    99 	-- for Lua
   100 	luaPatternProperties: { string : schema_t }
   100 	luaPatternProperties: { string : schema_t }
       
   101 	luaPattern : string
   101 
   102 
   102 	-- xml
   103 	-- xml
   103 	record xml_t
   104 	record xml_t
   104 		name : string
   105 		name : string
   105 		namespace : string
   106 		namespace : string
   223 			return false
   224 			return false
   224 		end
   225 		end
   225 		if schema.minLength and #data < schema.minLength then
   226 		if schema.minLength and #data < schema.minLength then
   226 			return false
   227 			return false
   227 		end
   228 		end
       
   229 		if schema.luaPattern and not data:match(schema.luaPattern) then
       
   230 			return false
       
   231 		end
   228 	end
   232 	end
   229 
   233 
   230 	if data is number then
   234 	if data is number then
   231 		if schema.multipleOf and (data == 0 or data % schema.multipleOf ~= 0) then
   235 		if schema.multipleOf and (data == 0 or data % schema.multipleOf ~= 0) then
   232 			return false
   236 			return false