cmccabe commented on code in PR #17684:
URL: https://github.com/apache/kafka/pull/17684#discussion_r1829718558
##########
generator/src/main/java/org/apache/kafka/message/checker/CheckerUtils.java:
##########
@@ -91,4 +102,54 @@ static MessageSpec readMessageSpecFromFile(String
schemaPath) {
throw new RuntimeException("Unable to parse file as MessageSpec: "
+ schemaPath, e);
}
}
+
+ /**
+ * Return a MessageSpec file give file contents.
+ *
+ * @param contents The path to read the file from.
+ * @return The MessageSpec.
+ */
+ static MessageSpec readMessageSpecFromString(String contents) {
+ try {
+ File tempFile = new File("temp.txt");
+ tempFile.createNewFile();
+ Files.write(Paths.get("temp.txt"), contents.getBytes());
+ MessageSpec messageSpec =
MessageGenerator.JSON_SERDE.readValue(tempFile, MessageSpec.class);
+ tempFile.deleteOnExit();
+ return messageSpec;
+ } catch (Exception e) {
+ throw new RuntimeException("Unable to parse file as MessageSpec: "
+ contents, e);
+ }
+ }
+
+
+ /**
+ * Read a MessageSpec file from remote git repo.
+ *
+ * @param fileCheckMetadata The file to read from remote git repo.
+ * @return The file contents.
+ */
+ static String GetDataFromGit(String fileCheckMetadata) throws IOException {
Review Comment:
I don't understand why the parameter is named `fileCheckMetadata`, can you
explain?
--
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]