Commit 343dc8e1 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

[1976] The "any" type is compatible with any default

The validation rejected all the values of "item_default" in spec files,
if the desired type was "any". Actually, the exact opposite is required,
since any type is compatible with "any".
parent 2536cfbc
......@@ -37,7 +37,7 @@ check_leaf_item(ConstElementPtr spec, const std::string& name,
Element::types type, bool mandatory)
{
if (spec->contains(name)) {
if (spec->get(name)->getType() == type) {
if (type == Element::any || spec->get(name)->getType() == type) {
return;
} else {
isc_throw(ModuleSpecError,
......
......@@ -110,6 +110,7 @@ TEST(ModuleSpec, SpecfileItems) {
"item_default not of type map");
moduleSpecError("spec15.spec",
"badname is not a valid type name");
EXPECT_NO_THROW(moduleSpecFromFile(specfile("spec40.spec")));
}
TEST(ModuleSpec, SpecfileConfigData) {
......
......@@ -66,3 +66,4 @@ EXTRA_DIST += spec36.spec
EXTRA_DIST += spec37.spec
EXTRA_DIST += spec38.spec
EXTRA_DIST += spec39.spec
EXTRA_DIST += spec40.spec
{
"module_spec": {
"module_name": "Spec40",
"config_data": [
{ "item_name": "item1",
"item_type": "any",
"item_optional": false,
"item_default": "asdf"
}
]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment