unknowntpo commented on code in PR #22588: URL: https://github.com/apache/kafka/pull/22588#discussion_r3563871902
########## connect/runtime/src/test/java/org/apache/kafka/connect/runtime/SamplePartiallyValidatingConnector.java: ########## @@ -0,0 +1,52 @@ +/* + * 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. + */ +package org.apache.kafka.connect.runtime; + +import org.apache.kafka.common.config.Config; +import org.apache.kafka.common.config.ConfigDef; +import org.apache.kafka.common.config.ConfigValue; + +import java.util.List; +import java.util.Map; + +/** + * The purpose of this connector is to check that the error validation process can handle partially validated configuration. + * This connector will validate only a subset of the overall configuration. + * Debezium (and maybe others) have a concept of deprecated field that are not validated. + */ +public class SamplePartiallyValidatingConnector extends SampleSourceConnector { + + @Override + public ConfigDef config() { + return new ConfigDef() + .define("required", ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, "required docs") + .define("optional", ConfigDef.Type.STRING, "defaultVal", ConfigDef.Importance.HIGH, "optional docs"); + } + + /** + * Do not validate "optional" on purpose. + */ + @Override + public Config validate(Map<String, String> connectorConfigs) { + // do not validate "optional" on purpose Review Comment: We can remove this line. I think the javadoc is sufficient. ########## connect/runtime/src/test/java/org/apache/kafka/connect/runtime/SamplePartiallyValidatingConnector.java: ########## @@ -0,0 +1,52 @@ +/* + * 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. + */ +package org.apache.kafka.connect.runtime; + +import org.apache.kafka.common.config.Config; +import org.apache.kafka.common.config.ConfigDef; +import org.apache.kafka.common.config.ConfigValue; + +import java.util.List; +import java.util.Map; + +/** + * The purpose of this connector is to check that the error validation process can handle partially validated configuration. + * This connector will validate only a subset of the overall configuration. + * Debezium (and maybe others) have a concept of deprecated field that are not validated. + */ +public class SamplePartiallyValidatingConnector extends SampleSourceConnector { + + @Override + public ConfigDef config() { + return new ConfigDef() + .define("required", ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, "required docs") + .define("optional", ConfigDef.Type.STRING, "defaultVal", ConfigDef.Importance.HIGH, "optional docs"); + } + + /** + * Do not validate "optional" on purpose. + */ Review Comment: ```suggestion /** * Skips validating "optional", so it produces no ConfigValue. */ ``` -- 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]
