Parse key values as leaf_data

Change-Id: Ib70a47dd4bcea0426d3b2063a845d4ce075d81f4
diff --git a/src/ast_commands.hpp b/src/ast_commands.hpp
index c5ffb61..7f3160a 100644
--- a/src/ast_commands.hpp
+++ b/src/ast_commands.hpp
@@ -14,7 +14,7 @@
 
 namespace x3 = boost::spirit::x3;
 
-using keyValue_ = std::pair<std::string, std::string>;
+using keyValue_ = std::pair<std::string, leaf_data_>;
 
 enum class LsOption {
     Recursive
diff --git a/src/ast_handlers.hpp b/src/ast_handlers.hpp
index 1fb7242..0ce611d 100644
--- a/src/ast_handlers.hpp
+++ b/src/ast_handlers.hpp
@@ -25,14 +25,10 @@
     void on_success(Iterator const&, Iterator const&, T& ast, Context const& context)
     {
         auto& parserContext = x3::get<parser_context_tag>(context);
-        const Schema& schema = parserContext.m_schema;
 
         if (parserContext.m_tmpListKeys.find(ast.first) != parserContext.m_tmpListKeys.end()) {
             _pass(context) = false;
             parserContext.m_errorMsg = "Key \"" + ast.first + "\" was entered more than once.";
-        } else if (!schema.listHasKey(parserContext.currentSchemaPath(), {parserContext.m_curModule, parserContext.m_tmpListName}, ast.first)) {
-            _pass(context) = false;
-            parserContext.m_errorMsg = parserContext.m_tmpListName + " is not indexed by \"" + ast.first + "\".";
         } else {
             parserContext.m_tmpListKeys.insert(ast.first);
         }
@@ -61,7 +57,28 @@
     }
 };
 
-struct key_identifier_class;
+struct key_identifier_class {
+    template <typename T, typename Iterator, typename Context>
+    void on_success(Iterator const&, Iterator const&, T& ast, Context const& context)
+    {
+        auto& parserContext = x3::get<parser_context_tag>(context);
+        const Schema& schema = parserContext.m_schema;
+        schemaPath_ location = parserContext.currentSchemaPath();
+        ModuleNodePair list{parserContext.m_curModule, parserContext.m_tmpListName};
+
+        if (schema.listHasKey(location, list, ast)) {
+            schemaNode_ listNode;
+            listNode.m_prefix = parserContext.m_curModule ? boost::optional<module_>{{*parserContext.m_curModule}} : boost::none;
+            listNode.m_suffix = list_{parserContext.m_tmpListName};
+            location.m_nodes.push_back(listNode);
+            parserContext.m_tmpListKeyLeafPath.m_location = location;
+            parserContext.m_tmpListKeyLeafPath.m_node = {boost::none, ast};
+        } else {
+            parserContext.m_errorMsg = parserContext.m_tmpListName + " is not indexed by \"" + ast + "\".";
+            _pass(context) = false;
+        }
+    }
+};
 
 struct module_identifier_class;
 
@@ -348,11 +365,18 @@
 
 struct leaf_path_class {
     template <typename T, typename Iterator, typename Context>
-    void on_success(Iterator const&, Iterator const&, T& ast, Context const& context)
+    void on_success(Iterator const&, Iterator const&, T&, Context const& context)
     {
         auto& parserContext = x3::get<parser_context_tag>(context);
         try {
-            auto leaf = boost::get<leaf_>(ast.m_nodes.back().m_suffix);
+            auto lastNode = parserContext.currentSchemaPath().m_nodes.back();
+            auto leaf = boost::get<leaf_>(lastNode.m_suffix);
+            auto location = pathWithoutLastNode(parserContext.currentSchemaPath());
+            ModuleNodePair node{lastNode.m_prefix.flat_map([](const auto& it) { return boost::optional<std::string>{it.m_name}; }), leaf.m_name};
+
+            parserContext.m_tmpListKeyLeafPath.m_location = location;
+            parserContext.m_tmpListKeyLeafPath.m_node = node;
+
         } catch (boost::bad_get&) {
             parserContext.m_errorMsg = "This is not a path to leaf.";
             _pass(context) = false;
@@ -383,12 +407,8 @@
         auto& parserContext = x3::get<parser_context_tag>(context);
         auto& schema = parserContext.m_schema;
         if (parserContext.m_errorMsg.empty()) {
-            leaf_ leaf = boost::get<leaf_>(parserContext.currentSchemaPath().m_nodes.back().m_suffix);
-            schemaPath_ location = pathWithoutLastNode(parserContext.currentSchemaPath());
-            boost::optional<std::string> module;
-            if (parserContext.currentSchemaPath().m_nodes.back().m_prefix)
-                module = parserContext.currentSchemaPath().m_nodes.back().m_prefix.value().m_name;
-            parserContext.m_errorMsg = "leaf data type mismatch: Expected " + leafDataTypeToString(schema.leafType(location, {module, leaf.m_name})) + " here:";
+            parserContext.m_errorMsg = "leaf data type mismatch: Expected " +
+                leafDataTypeToString(schema.leafType(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node)) + " here:";
             return x3::error_handler_result::fail;
         }
         return x3::error_handler_result::rethrow;
@@ -409,17 +429,12 @@
     {
         auto& parserContext = x3::get<parser_context_tag>(context);
         auto& schema = parserContext.m_schema;
-        boost::optional<std::string> module;
-        if (parserContext.currentSchemaPath().m_nodes.back().m_prefix)
-            module = parserContext.currentSchemaPath().m_nodes.back().m_prefix.value().m_name;
 
-        leaf_ leaf = boost::get<leaf_>(parserContext.currentSchemaPath().m_nodes.back().m_suffix);
-        schemaPath_ location = pathWithoutLastNode(parserContext.currentSchemaPath());
-
-        auto type = schema.leafType(location, {module, leaf.m_name});
+        auto type = schema.leafType(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node);
         if (type == yang::LeafDataTypes::LeafRef) {
-            type = schema.leafrefBase(location, {module, leaf.m_name});
+            type = schema.leafrefBase(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node);
         }
+
         if (type != m_type) {
             _pass(context) = false;
         }
@@ -440,18 +455,11 @@
             return;
         auto& parserContext = x3::get<parser_context_tag>(context);
         auto& schema = parserContext.m_schema;
-        boost::optional<std::string> module;
-        if (parserContext.currentSchemaPath().m_nodes.back().m_prefix)
-            module = parserContext.currentSchemaPath().m_nodes.back().m_prefix.value().m_name;
 
-        leaf_ leaf = boost::get<leaf_>(parserContext.currentSchemaPath().m_nodes.back().m_suffix);
-        schemaPath_ location = pathWithoutLastNode(parserContext.currentSchemaPath());
-
-        if (!schema.leafEnumHasValue(location, {module, leaf.m_name}, ast.m_value)) {
+        if (!schema.leafEnumHasValue(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node, ast.m_value)) {
             _pass(context) = false;
-
             parserContext.m_errorMsg = "leaf data type mismatch: Expected an enum here. Allowed values:";
-            for (const auto& it : schema.enumValues(location, {module, leaf.m_name})) {
+            for (const auto& it : schema.enumValues(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node)) {
                 parserContext.m_errorMsg += " " + it;
             }
         }
@@ -473,12 +481,6 @@
             return;
         auto& parserContext = x3::get<parser_context_tag>(context);
         auto& schema = parserContext.m_schema;
-        boost::optional<std::string> module;
-        if (parserContext.currentSchemaPath().m_nodes.back().m_prefix)
-            module = parserContext.currentSchemaPath().m_nodes.back().m_prefix.value().m_name;
-
-        leaf_ leaf = boost::get<leaf_>(parserContext.currentSchemaPath().m_nodes.back().m_suffix);
-        schemaPath_ location = pathWithoutLastNode(parserContext.currentSchemaPath());
 
         ModuleValuePair pair;
         if (ast.m_prefix) {
@@ -486,7 +488,7 @@
         }
         pair.second = ast.m_value;
 
-        if (!schema.leafIdentityIsValid(location, {module, leaf.m_name}, pair)) {
+        if (!schema.leafIdentityIsValid(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node, pair)) {
             _pass(context) = false;
         }
     }
@@ -645,20 +647,14 @@
     void on_success(Iterator const& begin, Iterator const&, T&, Context const& context)
     {
         auto& parserContext = x3::get<parser_context_tag>(context);
-        parserContext.m_completionIterator = begin;
         const Schema& schema = parserContext.m_schema;
 
-        boost::optional<std::string> module;
-        if (parserContext.currentSchemaPath().m_nodes.back().m_prefix)
-            module = parserContext.currentSchemaPath().m_nodes.back().m_prefix.value().m_name;
-
-        leaf_ leaf = boost::get<leaf_>(parserContext.currentSchemaPath().m_nodes.back().m_suffix);
-        schemaPath_ location = pathWithoutLastNode(parserContext.currentSchemaPath());
+        parserContext.m_completionIterator = begin;
 
         // Only generate completions if the type is enum so that we don't
         // overwrite some other completions.
-        if (schema.leafType(location, {module, leaf.m_name}) == yang::LeafDataTypes::Enum)
-            parserContext.m_suggestions = schema.enumValues(location, {module, leaf.m_name});
+        if (schema.leafType(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node) == yang::LeafDataTypes::Enum)
+            parserContext.m_suggestions = schema.enumValues(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node);
     }
 };
 
@@ -668,19 +664,13 @@
     void on_success(Iterator const& begin, Iterator const&, T&, Context const& context)
     {
         auto& parserContext = x3::get<parser_context_tag>(context);
-        parserContext.m_completionIterator = begin;
         const Schema& schema = parserContext.m_schema;
 
-        boost::optional<std::string> module;
-        if (parserContext.currentSchemaPath().m_nodes.back().m_prefix)
-            module = parserContext.currentSchemaPath().m_nodes.back().m_prefix.value().m_name;
-
-        leaf_ leaf = boost::get<leaf_>(parserContext.currentSchemaPath().m_nodes.back().m_suffix);
-        schemaPath_ location = pathWithoutLastNode(parserContext.currentSchemaPath());
+        parserContext.m_completionIterator = begin;
 
         // Only generate completions if the type is identityref so that we
         // don't overwrite some other completions.
-        if (schema.leafType(location, {module, leaf.m_name}) == yang::LeafDataTypes::IdentityRef)
-            parserContext.m_suggestions = schema.validIdentities(location, {module, leaf.m_name}, Prefixes::WhenNeeded);
+        if (schema.leafType(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node) == yang::LeafDataTypes::IdentityRef)
+            parserContext.m_suggestions = schema.validIdentities(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node, Prefixes::WhenNeeded);
     }
 };
diff --git a/src/ast_path.cpp b/src/ast_path.cpp
index bdb3447..e3e45d4 100644
--- a/src/ast_path.cpp
+++ b/src/ast_path.cpp
@@ -72,7 +72,7 @@
     return this->m_name == b.m_name;
 }
 
-listElement_::listElement_(const std::string& listName, const std::map<std::string, std::string>& keys)
+listElement_::listElement_(const std::string& listName, const std::map<std::string, leaf_data_>& keys)
     : m_name(listName)
     , m_keys(keys)
 {
@@ -138,7 +138,7 @@
         res << node.m_name + "[";
         std::transform(node.m_keys.begin(), node.m_keys.end(),
                 std::experimental::make_ostream_joiner(res, "]["),
-                [] (const auto& it) { return it.first + "=" + escapeListKeyString(it.second); });
+                [] (const auto& it) { return it.first + "=" + escapeListKeyString(leafDataToString(it.second)); });
         res << "]";
         return res.str();
     }
diff --git a/src/ast_path.hpp b/src/ast_path.hpp
index 338c766..966f771 100644
--- a/src/ast_path.hpp
+++ b/src/ast_path.hpp
@@ -48,12 +48,12 @@
 
 struct listElement_ {
     listElement_() {}
-    listElement_(const std::string& listName, const std::map<std::string, std::string>& keys);
+    listElement_(const std::string& listName, const std::map<std::string, leaf_data_>& keys);
 
     bool operator==(const listElement_& b) const;
 
     std::string m_name;
-    std::map<std::string, std::string> m_keys;
+    std::map<std::string, leaf_data_> m_keys;
 };
 
 struct list_ {
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 2574019..98ed8b7 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -107,13 +107,6 @@
         ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
     ];
 
-auto const quotedValue =
-    ('\'' > +(char_-'\'') > '\'') |
-    ('\"' > +(char_-'\"') > '\"');
-
-auto const number =
-    +x3::digit;
-
 auto const createKeySuggestions_def =
     x3::eps;
 
@@ -121,7 +114,7 @@
     x3::eps;
 
 auto const keyValue_def =
-    key_identifier > '=' > (quotedValue | number);
+    key_identifier > '=' > leaf_data;
 
 auto const keyValueWrapper =
     lexeme['[' > createKeySuggestions > keyValue > suggestKeysEnd > ']'];
diff --git a/src/parser_context.hpp b/src/parser_context.hpp
index b20c6ab..10a6634 100644
--- a/src/parser_context.hpp
+++ b/src/parser_context.hpp
@@ -23,6 +23,11 @@
     std::string m_tmpListName;
     bool m_topLevelModulePresent = false;
     std::set<std::string> m_tmpListKeys;
+
+    struct {
+        schemaPath_ m_location;
+        ModuleNodePair m_node;
+    } m_tmpListKeyLeafPath;
     bool m_errorHandled = false;
     bool m_completing = false;
     std::set<std::string> m_suggestions;
diff --git a/tests/cd.cpp b/tests/cd.cpp
index 1d03e78..8b569b7 100644
--- a/tests/cd.cpp
+++ b/tests/cd.cpp
@@ -24,8 +24,11 @@
     schema->addContainer("/example:a/example:a2", "example:a3");
     schema->addContainer("/example:b/example:b2", "example:b3");
     schema->addList("/", "example:list", {"number"});
+    schema->addLeaf("/example:list", "example:number", yang::LeafDataTypes::Int32);
     schema->addContainer("/example:list", "example:contInList");
     schema->addList("/", "example:twoKeyList", {"number", "name"});
+    schema->addLeaf("/example:twoKeyList", "example:number", yang::LeafDataTypes::Int32);
+    schema->addLeaf("/example:twoKeyList", "example:name", yang::LeafDataTypes::String);
     Parser parser(schema);
     std::string input;
     std::ostringstream errorStream;
@@ -98,16 +101,16 @@
             SECTION("example:list[number=1]")
             {
                 input = "cd example:list[number=1]";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "1"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{1}}};
                 expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("list", keys)));
             }
 
             SECTION("example:list[number=1]/contInList")
             {
                 input = "cd example:list[number=1]/contInList";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "1"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{1}}};
                 expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("list", keys)));
                 expected.m_path.m_nodes.push_back(dataNode_(container_("contInList")));
             }
@@ -115,9 +118,9 @@
             SECTION("example:twoKeyList[number=4][name='abcd']")
             {
                 input = "cd example:twoKeyList[number=4][name='abcd']";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "4"},
-                    {"name", "abcd"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{4}},
+                    {"name", std::string{"abcd"}}};
                 expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("twoKeyList", keys)));
             }
         }
diff --git a/tests/enum_completion.cpp b/tests/enum_completion.cpp
index a8ec4d2..d7dfd58 100644
--- a/tests/enum_completion.cpp
+++ b/tests/enum_completion.cpp
@@ -19,6 +19,7 @@
     schema->addLeafEnum("/", "mod:leafEnum", {"lala", "lol", "data", "coze"});
     schema->addLeafEnum("/mod:contA", "mod:leafInCont", {"abc", "def"});
     schema->addList("/", "mod:list", {"number"});
+    schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
     schema->addLeafEnum("/mod:list", "mod:leafInList", {"ano", "anoda", "ne", "katoda"});
     Parser parser(schema);
     std::string input;
diff --git a/tests/leaf_editing.cpp b/tests/leaf_editing.cpp
index d7703c0..61704f6 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -47,6 +47,7 @@
     schema->addLeafEnum("/", "mod:leafEnum", {"lol", "data", "coze"});
     schema->addLeaf("/mod:contA", "mod:leafInCont", yang::LeafDataTypes::String);
     schema->addList("/", "mod:list", {"number"});
+    schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
     schema->addLeaf("/mod:list", "mod:leafInList", yang::LeafDataTypes::String);
     schema->addLeafRef("/", "mod:refToString", "/mod:leafString");
     schema->addLeafRef("/", "mod:refToInt8", "/mod:leafInt8");
@@ -100,8 +101,8 @@
         SECTION("set mod:list[number=1]/leafInList \"another_data\"")
         {
             input = "set mod:list[number=1]/leafInList \"another_data\"";
-            auto keys = std::map<std::string, std::string>{
-                {"number", "1"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"number", int32_t{1}}};
             expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, listElement_("list", keys)});
             expected.m_path.m_nodes.push_back(dataNode_{leaf_("leafInList")});
             expected.m_data = std::string("another_data");
diff --git a/tests/list_manipulation.cpp b/tests/list_manipulation.cpp
index 3fa7a8b..5100c61 100644
--- a/tests/list_manipulation.cpp
+++ b/tests/list_manipulation.cpp
@@ -14,6 +14,7 @@
     auto schema = std::make_shared<StaticSchema>();
     schema->addModule("mod");
     schema->addList("/", "mod:list", {"number"});
+    schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
     schema->addLeaf("/mod:list", "mod:leafInList", yang::LeafDataTypes::String);
     Parser parser(schema);
     std::string input;
@@ -25,8 +26,8 @@
         SECTION("mod:list[number=3]")
         {
             input = "mod:list[number=3]";
-            auto keys = std::map<std::string, std::string>{
-                {"number", "3"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"number", int32_t{3}}};
             expectedPath.m_nodes.push_back(dataNode_{module_{"mod"}, listElement_("list", keys)});
         }
 
diff --git a/tests/ls.cpp b/tests/ls.cpp
index 0df428b..8709f13 100644
--- a/tests/ls.cpp
+++ b/tests/ls.cpp
@@ -25,8 +25,11 @@
     schema->addContainer("/example:a/example:a2", "example:a3");
     schema->addContainer("/example:b/example:b2", "example:b3");
     schema->addList("/", "example:list", {"number"});
+    schema->addLeaf("/example:list", "example:number", yang::LeafDataTypes::Int32);
     schema->addContainer("/example:list", "example:contInList");
     schema->addList("/", "example:twoKeyList", {"number", "name"});
+    schema->addLeaf("/example:twoKeyList", "example:number", yang::LeafDataTypes::Int32);
+    schema->addLeaf("/example:twoKeyList", "example:name", yang::LeafDataTypes::String);
     Parser parser(schema);
     std::string input;
     std::ostringstream errorStream;
@@ -153,8 +156,8 @@
             SECTION("ls example:list[number=342]/contInList")
             {
                 input = "ls example:list[number=342]/contInList";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "342"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{342}}};
                 expected.m_path = dataPath_{Scope::Relative, {dataNode_(module_{"example"}, listElement_{"list", keys}),
                                                                 dataNode_(container_{"contInList"})}};
             }
diff --git a/tests/path_completion.cpp b/tests/path_completion.cpp
index 115cfdd..77dae51 100644
--- a/tests/path_completion.cpp
+++ b/tests/path_completion.cpp
@@ -36,10 +36,15 @@
     schema->addContainer("/example:ano/example:a2", "example:a3");
     schema->addContainer("/example:bota/example:b2", "example:b3");
     schema->addList("/", "example:list", {"number"});
-    schema->addList("/", "example:ovoce", {"name"});
-    schema->addList("/", "example:ovocezelenina", {"name"});
+    schema->addLeaf("/example:list", "example:number", yang::LeafDataTypes::Int32);
     schema->addContainer("/example:list", "example:contInList");
+    schema->addList("/", "example:ovoce", {"name"});
+    schema->addLeaf("/example:ovoce", "example:name", yang::LeafDataTypes::String);
+    schema->addList("/", "example:ovocezelenina", {"name"});
+    schema->addLeaf("/example:ovocezelenina", "example:name", yang::LeafDataTypes::String);
     schema->addList("/", "example:twoKeyList", {"number", "name"});
+    schema->addLeaf("/example:twoKeyList", "example:name", yang::LeafDataTypes::String);
+    schema->addLeaf("/example:twoKeyList", "example:number", yang::LeafDataTypes::Int32);
     schema->addLeaf("/", "example:leafInt", yang::LeafDataTypes::Int32);
     Parser parser(schema);
     std::string input;
@@ -111,13 +116,13 @@
         SECTION("ls /example:list[number=3]/")
         {
             input = "ls /example:list[number=3]/";
-            expected = {"example:contInList/"};
+            expected = {"example:contInList/", "example:number "};
         }
 
         SECTION("ls /example:list[number=3]/c")
         {
             input = "ls /example:list[number=3]/e";
-            expected = {"example:contInList/"};
+            expected = {"example:contInList/", "example:number "};
         }
 
         SECTION("ls /example:list[number=3]/a")
diff --git a/tests/path_utils.cpp b/tests/path_utils.cpp
index f8dc250..c23984d 100644
--- a/tests/path_utils.cpp
+++ b/tests/path_utils.cpp
@@ -25,7 +25,7 @@
             {
                 path.m_scope = Scope::Relative;
             }
-            path.m_nodes.push_back(dataNode_{module_{"example-schema"}, listElement_{"twoKeyList", {{"first", "a"}, {"second", "b"}}}});
+            path.m_nodes.push_back(dataNode_{module_{"example-schema"}, listElement_{"twoKeyList", {{"first", std::string{"a"}}, {"second", std::string{"b"}}}}});
             expected += "example-schema:twoKeyList[first='a'][second='b']";
         }
         REQUIRE(pathToDataString(path, Prefixes::WhenNeeded) == expected);
diff --git a/tests/presence_containers.cpp b/tests/presence_containers.cpp
index ba8938e..d634daf 100644
--- a/tests/presence_containers.cpp
+++ b/tests/presence_containers.cpp
@@ -22,6 +22,7 @@
     schema->addContainer("/mod:a/mod:a2", "mod:a3", yang::ContainerTraits::Presence);
     schema->addContainer("/mod:b", "mod:b2", yang::ContainerTraits::Presence);
     schema->addList("/", "mod:list", {"quote"});
+    schema->addLeaf("/mod:list", "mod:quote", yang::LeafDataTypes::String);
     schema->addContainer("/mod:list", "mod:contInList", yang::ContainerTraits::Presence);
     Parser parser(schema);
     std::string input;
@@ -52,24 +53,24 @@
         SECTION("mod:list[quote='lol']/contInList")
         {
             input = "mod:list[quote='lol']/contInList";
-            auto keys = std::map<std::string, std::string>{
-                {"quote", "lol"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"quote", std::string{"lol"}}};
             expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
         }
 
         SECTION("mod:list[quote='double\"quote']/contInList")
         {
             input = "mod:list[quote='double\"quote']/contInList";
-            auto keys = std::map<std::string, std::string>{
-                {"quote", "double\"quote"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"quote", std::string{"double\"quote"}}};
             expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
         }
 
         SECTION("mod:list[quote=\"single'quote\"]/contInList")
         {
             input = "mod:list[quote=\"single'quote\"]/contInList";
-            auto keys = std::map<std::string, std::string>{
-                {"quote", "single'quote"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"quote", std::string{"single'quote"}}};
             expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
         }