@@ -227,15 +227,15 @@ function codectx_mt:handle_error(indent, error_msg, schema_path, instance_path)
227227 self :stmt (sformat (' %stable.insert(errors, {schema_path = %s, instance_path = %s, error = %s})' , indent , schema_path , instance_path , error_msg ))
228228 else
229229 self :stmt (sformat (' %sreturn false, %s' , indent , error_msg ))
230- end
230+ end
231231end
232232
233233function codectx_mt :merge_child_errors (indent , err_var , path_prefix , instance_prefix )
234234 indent = indent or ' '
235235 if self ._root ._collect_all_errors then
236236
237237 self :stmt (sformat (' %sif type(%s) == "table" then' , indent , err_var ))
238-
238+
239239 self :stmt (sformat (' %s for _, sub_err in ipairs(%s) do' , indent , err_var ))
240240 if path_prefix and path_prefix ~= ' ' then
241241 -- 47 is the ASCII code for '/'
@@ -908,7 +908,7 @@ generate_validator = function(ctx, schema)
908908 local format_escaped_pattern = string.gsub (schema .pattern , " %%" , " %%%%" )
909909
910910 ctx :stmt (sformat (' if not %s(%s, %q) then' , ctx :libfunc (' custom.match_pattern' ), ctx :param (1 ), schema .pattern ))
911- ctx :handle_error (' ' , sformat (' %s([[failed to match pattern ]] .. %q .. [[ with %%q]], %s)' ,
911+ ctx :handle_error (' ' , sformat (' %s([[failed to match pattern ]] .. %q .. [[ with %%q]], %s)' ,
912912 ctx :libfunc (' string.format' ), format_escaped_pattern , ctx :param (1 )), ' "/pattern"' )
913913 ctx :stmt ( ' end' )
914914 end
@@ -1008,7 +1008,7 @@ generate_validator = function(ctx, schema)
10081008 ctx :stmt ( ' end' )
10091009 if ctx ._root ._collect_all_errors and schema .format == " date-time" then
10101010 ctx :stmt ( ' if record_err then' )
1011- ctx :stmt (sformat ( ' table.insert(errors, {schema_path = "/format", instance_path = "", error = %s})' ,
1011+ ctx :stmt (sformat ( ' table.insert(errors, {schema_path = "/format", instance_path = "", error = %s})' ,
10121012 sformat (' %s([[expected valid %q, got %%q]], %s)' , ctx :libfunc (' string.format' ), schema .format , ctx :param (1 ))))
10131013 ctx :stmt ( ' end' )
10141014 ctx :stmt ( ' end' )
@@ -1221,7 +1221,7 @@ local _M = {
12211221 -- There is no default implementation: this function must be provided if
12221222 -- resolving external schemas is required. The function signature should be: `function(url)`
12231223 -- @tparam [opt] bool custom.collect_all_errors If set to true, the validator will collect all validation errors
1224- -- instead of stopping at the first one. The error message contains:
1224+ -- instead of stopping at the first one. The error message contains:
12251225 -- * schema_path: Path to the JSON Schema keyword that failed validation.
12261226 -- * instance_path: Path to the value that failed validation.
12271227 -- * error: The error message.
0 commit comments