[
https://issues.apache.org/jira/browse/MINIFICPP-465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16496841#comment-16496841
]
ASF GitHub Bot commented on MINIFICPP-465:
------------------------------------------
Github user phrocker commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/350#discussion_r192165204
--- Diff: libminifi/src/core/yaml/YamlConfiguration.cpp ---
@@ -782,29 +783,59 @@ void
YamlConfiguration::parsePropertiesNodeYaml(YAML::Node *propertiesNode,
}
}
+ validateComponentProperties(processor, component_name, yaml_section);
+}
+
+void YamlConfiguration::validateComponentProperties(const
std::shared_ptr<ConfigurableComponent> &component,
+ const std::string
&component_name,
+ const std::string
&yaml_section) const {
+ const auto &component_properties = component->getProperties();
+
// Validate required properties
- for (const auto &prop_pair : processor->getProperties()) {
+ for (const auto &prop_pair : component_properties) {
if (prop_pair.second.getRequired()) {
- const auto &val = prop_pair.second.getValue();
-
- if (val.empty()) {
- // Build a helpful error message for the user so they can fix the
- // invalid YAML config file, using the component name if present
- std::string err_msg =
- "Unable to parse configuration file for component named '"
- + component_name
- + "' because required property '" +
prop_pair.second.getName() + "' is not set";
- if (!yaml_section.empty()) {
- err_msg += " [in '" + yaml_section + "' section of configuration
file]";
- }
- logging::LOG_ERROR(logger_) << err_msg;
+ if (prop_pair.second.getValue().empty()) {
+ std::string reason("required property '");
--- End diff --
Why not use a string stream here?
> Regex property validation
> -------------------------
>
> Key: MINIFICPP-465
> URL: https://issues.apache.org/jira/browse/MINIFICPP-465
> Project: NiFi MiNiFi C++
> Issue Type: Improvement
> Reporter: Andrew Christianson
> Assignee: Andrew Christianson
> Priority: Major
>
> Support validation of processor properties via regular expression.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)