martinzink commented on code in PR #2186: URL: https://github.com/apache/nifi-minifi-cpp/pull/2186#discussion_r3643232164
########## minifi_rust/minifi_native/src/api/property.rs: ########## @@ -0,0 +1,117 @@ +// 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 +// +// https://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. + +use crate::StandardPropertyValidator::{ + BoolValidator, DataSizeValidator, TimePeriodValidator, U64Validator, +}; +use crate::{ + ComponentIdentifier, ControllerServiceDefinition, EnableControllerService, MinifiError, +}; +use std::str::FromStr; +use std::time::Duration; + +#[derive(Debug, Eq, PartialEq)] +pub enum StandardPropertyValidator { + AlwaysValidValidator, + NonBlankValidator, + TimePeriodValidator, + BoolValidator, + I64Validator, + U64Validator, + DataSizeValidator, + PortValidator, +} + +#[derive(Debug)] +pub struct Property { + pub name: &'static str, + pub description: &'static str, + pub is_required: bool, + pub is_sensitive: bool, + pub supports_expr_lang: bool, + pub default_value: Option<&'static str>, + pub validator: StandardPropertyValidator, + pub allowed_values: &'static [&'static str], Review Comment: good point, now that i think about it, we can go much further and merge the validator the allowed values and allowed types together, (no need to restrict the rust api, we can unpack it later so c api understands it) but this is a bit larger modification so i think im gonna do it in an upcoming PR (with some improvements i've already done) -- 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]
