comparison mod_rest/jsonmap.lib.lua @ 3885:1ec45dbc7db5

mod_rest: Return an error for unknown fields in JSON input Helps you discover typos and such.
author Kim Alvefur <zash@zash.se>
date Fri, 07 Feb 2020 20:49:07 +0100
parents 5d7df207dc2b
children b64b08b7bf8e
comparison
equal deleted inserted replaced
3884:f84ede3e9e3b 3885:1ec45dbc7db5
462 elseif typ[1] == "bool_tag" then 462 elseif typ[1] == "bool_tag" then
463 s:tag(typ[3] or k, { xmlns = typ[2] }):up(); 463 s:tag(typ[3] or k, { xmlns = typ[2] }):up();
464 elseif typ[1] == "func" then 464 elseif typ[1] == "func" then
465 s:add_child(typ[5](v)):up(); 465 s:add_child(typ[5](v)):up();
466 end 466 end
467 else
468 return nil, "unknown-field";
467 end 469 end
468 end 470 end
469 471
470 s:reset(); 472 s:reset();
471 473