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".
@@ -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
@@ -0,0 +1,13 @@
+{
+ "module_spec": {
+ "module_name": "Spec40",
+ "config_data": [
+ { "item_name": "item1",
+ "item_type": "any",
+ "item_optional": false,
+ "item_default": "asdf"
+ }
+ ]
+}
+