diff --git a/ddspipe_yaml/src/cpp/YamlReader_generic.cpp b/ddspipe_yaml/src/cpp/YamlReader_generic.cpp index dbdbc1fb..26277959 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_generic.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_generic.cpp @@ -39,6 +39,7 @@ #include #include +#include #include namespace eprosima { @@ -291,12 +292,31 @@ std::string YamlReader::get( return get_scalar(yml); } +template <> +DDSPIPE_YAML_DllAPI +bool YamlValidator::validate( + const Yaml& yml, + const YamlReaderVersion& /* version */) +{ + const std::set tags{ + TIMESTAMP_DATETIME_FORMAT_TAG, + TIMESTAMP_LOCAL_TAG, + TIMESTAMP_DATETIME_TAG, + TIMESTAMP_MILLISECONDS_TAG, + TIMESTAMP_MICROSECONDS_TAG, + TIMESTAMP_NANOSECONDS_TAG}; + + return YamlValidator::validate_tags(yml, tags); +} + template <> DDSPIPE_YAML_DllAPI utils::Timestamp YamlReader::get( const Yaml& yml, const YamlReaderVersion version /* version */) { + YamlValidator::validate(yml, version); + utils::Timestamp ret_timestamp; std::string datetime_str; std::string datetime_format("%Y-%m-%d_%H-%M-%S"); diff --git a/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt index 700c4396..2402cd08 100644 --- a/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt @@ -20,6 +20,7 @@ set(TEST_NAME YamlWriterTest) set(TEST_SOURCES ${PROJECT_SOURCE_DIR}/src/cpp/YamlReader_generic.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/YamlValidator.cpp ${PROJECT_SOURCE_DIR}/src/cpp/YamlWriter.cpp YamlWriterTest.cpp ) @@ -61,6 +62,7 @@ set(TEST_NAME YamlWriter_collections_test) set(TEST_SOURCES ${PROJECT_SOURCE_DIR}/src/cpp/YamlReader_generic.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/YamlValidator.cpp ${PROJECT_SOURCE_DIR}/src/cpp/YamlWriter.cpp YamlWriter_collections_test.cpp )