Re: [PR] KAFKA-16469: Metadata schema checker [kafka]
cmccabe commented on code in PR #15995: URL: https://github.com/apache/kafka/pull/15995#discussion_r1774076875 ## generator/src/main/java/org/apache/kafka/message/checker/MetadataSchemaCheckerTool.java: ## @@ -0,0 +1,88 @@ +/* + * 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.message.checker; + +import net.sourceforge.argparse4j.ArgumentParsers; +import net.sourceforge.argparse4j.inf.ArgumentParser; +import net.sourceforge.argparse4j.inf.Namespace; +import net.sourceforge.argparse4j.inf.Subparser; +import net.sourceforge.argparse4j.inf.Subparsers; +import net.sourceforge.argparse4j.internal.HelpScreenException; + +import java.io.PrintStream; + +public class MetadataSchemaCheckerTool { +public static void main(String[] args) throws Exception { +try { +run(args, System.out); +} catch (HelpScreenException e) { +} +} + +public static void run( +String[] args, +PrintStream writer +) throws Exception { +ArgumentParser argumentParser = ArgumentParsers. +newArgumentParser("metadata-schema-checker"). +defaultHelp(true). +description("The Kafka metadata schema checker tool."); +Subparsers subparsers = argumentParser.addSubparsers().dest("command"); +Subparser parseParser = subparsers.addParser("parse"). +help("Verify that a JSON file can be parsed as a MessageSpec."); +parseParser.addArgument("--path", "-p"). +required(true). +help("The path to a schema JSON file."); +Subparser evolutionVerifierParser = subparsers.addParser("verifyEvolution"). +help("Verify that an evolution of a JSON file is valid."); +evolutionVerifierParser.addArgument("--path1", "-1"). +required(true). +help("The initial schema JSON path."); +evolutionVerifierParser.addArgument("--path2", "-2"). +required(true). +help("The final schema JSON path."); +Namespace namespace; +if (args.length == 0) { +namespace = argumentParser.parseArgs(new String[] {"--help"}); +} else { +namespace = argumentParser.parseArgs(args); +} +String command = namespace.getString("command"); +switch (command) { +case "parse": { Review Comment: There is some validation done by the various constructors -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-16469: Metadata schema checker [kafka]
cmccabe commented on code in PR #15995: URL: https://github.com/apache/kafka/pull/15995#discussion_r1774073946 ## generator/src/main/java/org/apache/kafka/message/checker/MetadataSchemaCheckerTool.java: ## @@ -0,0 +1,88 @@ +/* + * 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.message.checker; + +import net.sourceforge.argparse4j.ArgumentParsers; +import net.sourceforge.argparse4j.inf.ArgumentParser; +import net.sourceforge.argparse4j.inf.Namespace; +import net.sourceforge.argparse4j.inf.Subparser; +import net.sourceforge.argparse4j.inf.Subparsers; +import net.sourceforge.argparse4j.internal.HelpScreenException; + +import java.io.PrintStream; + +public class MetadataSchemaCheckerTool { +public static void main(String[] args) throws Exception { +try { +run(args, System.out); +} catch (HelpScreenException e) { +} +} + +public static void run( +String[] args, +PrintStream writer +) throws Exception { +ArgumentParser argumentParser = ArgumentParsers. +newArgumentParser("metadata-schema-checker"). +defaultHelp(true). +description("The Kafka metadata schema checker tool."); +Subparsers subparsers = argumentParser.addSubparsers().dest("command"); +Subparser parseParser = subparsers.addParser("parse"). +help("Verify that a JSON file can be parsed as a MessageSpec."); +parseParser.addArgument("--path", "-p"). +required(true). +help("The path to a schema JSON file."); +Subparser evolutionVerifierParser = subparsers.addParser("verifyEvolution"). Review Comment: yeah, let's use dashes here -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-16469: Metadata schema checker [kafka]
cmccabe commented on code in PR #15995: URL: https://github.com/apache/kafka/pull/15995#discussion_r1774072064 ## generator/src/main/java/org/apache/kafka/message/checker/EvolutionVerifier.java: ## @@ -0,0 +1,64 @@ +/* + * 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.message.checker; + +import org.apache.kafka.message.MessageSpec; + +public class EvolutionVerifier { +private final MessageSpec topLevelMessage1; +private final MessageSpec topLevelMessage2; + +public EvolutionVerifier( +MessageSpec topLevelMessage1, +MessageSpec topLevelMessage2 Review Comment: I've been using 1 and 2 throughout the code so changing this would be a big decision. I have to think about it... -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] KAFKA-16469: Metadata schema checker [kafka]
cmccabe opened a new pull request, #15995: URL: https://github.com/apache/kafka/pull/15995 Create a schema checker that can validate that later versions of a KRPC schema are compatible with earlier ones. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org