adamdebreceni commented on code in PR #1391: URL: https://github.com/apache/nifi-minifi-cpp/pull/1391#discussion_r997042389
########## libminifi/include/core/json/JsonNode.h: ########## @@ -0,0 +1,248 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <string> +#include <utility> +#include <memory> + +#include "core/flow/Node.h" +#include "rapidjson/document.h" +#include "utils/gsl.h" +#include "utils/ValueCaster.h" + +namespace org::apache::nifi::minifi::core { + +class JsonNode : public flow::Node::NodeImpl { Review Comment: I wouldn't say that we have implemented a tagged union, both `rapjson::Value` and `YAML::Node` are already tagged unions, the way I think of it, is that `flow::Node` encapsulates the visitation of these tagged unions, having to return a single variant (with something like a `flow::Node::getValue` method as I understand, but correct me if I misunderstood) could be problematic as for `YAML::Node` each scalar is a string and conversions happen on the fly, and the logic already accesses the original string (even if it is an int64) so we would need a method like `flow::Node::getString` I'm also not sure how we would handle the conversion errors, we currently get a nice error message straight from the yaml parser with location info and such, either we would have to capture this (as we do now) or track it ourselves (seems to be a significant change currently) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
