[ 
https://issues.apache.org/jira/browse/MINIFI-275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15993321#comment-15993321
 ] 

ASF GitHub Bot commented on MINIFI-275:
---------------------------------------

Github user kevdoran commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/85#discussion_r114375744
  
    --- Diff: libminifi/src/core/yaml/YamlConfiguration.cpp ---
    @@ -491,14 +510,18 @@ void YamlConfiguration::parsePortYaml(YAML::Node 
*portNode,
     
       YAML::Node inputPortsObj = portNode->as<YAML::Node>();
     
    -  // generate the random UIID
    -  uuid_generate(uuid);
    -
    -  auto portId = inputPortsObj["id"].as<std::string>();
    +  // Check for required fields
    +  checkRequiredField(&inputPortsObj, "name");
       auto nameStr = inputPortsObj["name"].as<std::string>();
    +  checkRequiredField(&inputPortsObj, "id", "The field 'id' is required for 
"
    +      "the port named '" + nameStr + "' in the YAML Config. If this port "
    +      "is specificy an input port for a NiFi Remote Process Group, the 
port "
    +      "id should match the id of of the input port in the NiFi 
configuration. "
    +      "This is a UUID of the format 
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.");
    +  auto portId = inputPortsObj["id"].as<std::string>();
       uuid_parse(portId.c_str(), uuid);
     
    -  port = new minifi::RemoteProcessorGroupPort(nameStr.c_str(), uuid);
    +  port = new minifi::RemoteProcessorGroupPort(nameStr, uuid);
     
       processor = (std::shared_ptr<core::Processor>) port;
    --- End diff --
    
    I updated my earlier comment. You're right, this is a one-off not an 
endemic issue.
    
    is this cast ok:
    
    `std::shared_ptr<core::Processor> processor = NULL;
    std::shared_ptr<minifi::RemoteProcessorGroupPort> port = NULL;
    port = new minifi::RemoteProcessorGroupPort(nameStr, uuid);
    processor = (std::shared_ptr<core::Processor>) port;
    `


> Configuration without IDs for components causes exceptions
> ----------------------------------------------------------
>
>                 Key: MINIFI-275
>                 URL: https://issues.apache.org/jira/browse/MINIFI-275
>             Project: Apache NiFi MiNiFi
>          Issue Type: Bug
>          Components: C++, Processing Configuration
>            Reporter: Aldrin Piri
>            Assignee: Kevin Doran
>            Priority: Blocker
>             Fix For: cpp-0.2.0
>
>         Attachments: config.TEST.yml
>
>
> One of the changes to how components are handled in C++ introduced a defect 
> into the original construct over the version 1 schema of the YAML.  
> The absence of this ID causes a YAML exception.  
> We should provide handling to support configurations how they were created 
> originally, possibly providing a default/generated ID where one isn't 
> specified, and start laying the foundation for versioned schemas as provided 
> in our Java implementation.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to