yang-cli: Make parsing strict by default and add flag

Change-Id: I941b0c4c43c94804cc3e429d1ab00ca6f1ad402e
diff --git a/src/yang_access.cpp b/src/yang_access.cpp
index b8631d5..0555616 100644
--- a/src/yang_access.cpp
+++ b/src/yang_access.cpp
@@ -312,14 +312,19 @@
     m_schema->enableFeature(module, feature);
 }
 
-void YangAccess::addDataFile(const std::string& path)
+void YangAccess::addDataFile(const std::string& path, const StrictDataParsing strict)
 {
     std::ifstream fs(path);
     char firstChar;
     fs >> firstChar;
 
     std::cout << "Parsing \"" << path << "\" as " << (firstChar == '{' ? "JSON" : "XML") << "...\n";
-    auto dataNode = lyd_parse_path(m_ctx.get(), path.c_str(), firstChar == '{' ? LYD_JSON : LYD_XML, LYD_OPT_DATA | LYD_OPT_DATA_NO_YANGLIB | LYD_OPT_TRUSTED);
+
+    auto parseFlags = LYD_OPT_DATA | LYD_OPT_DATA_NO_YANGLIB | LYD_OPT_TRUSTED;
+    if (strict == StrictDataParsing::Yes) {
+        parseFlags |= LYD_OPT_STRICT;
+    }
+    auto dataNode = lyd_parse_path(m_ctx.get(), path.c_str(), firstChar == '{' ? LYD_JSON : LYD_XML, parseFlags);
 
     if (!dataNode) {
         throw std::runtime_error("Supplied data file " + path + " couldn't be parsed.");