From 01f9a5ae53c3e864139e4b260fb7ddf9fe866a05 Mon Sep 17 00:00:00 2001 From: Dawid Poliszak Date: Thu, 17 Oct 2024 08:26:23 +0200 Subject: [PATCH] fix: problem with json content type validation --- src/components/editTopicDialog.tsx | 2 +- src/components/topicDialog.tsx | 2 +- src/components/validateTopicForm.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/editTopicDialog.tsx b/src/components/editTopicDialog.tsx index b9283bc..1e5214c 100644 --- a/src/components/editTopicDialog.tsx +++ b/src/components/editTopicDialog.tsx @@ -51,7 +51,7 @@ export const EditTopicDialog = observer(() => { , , - ContentType + Content type } label="AVRO" /> } label="JSON" /> diff --git a/src/components/topicDialog.tsx b/src/components/topicDialog.tsx index 6fc0138..855fe69 100644 --- a/src/components/topicDialog.tsx +++ b/src/components/topicDialog.tsx @@ -53,7 +53,7 @@ export const TopicDialog = observer( , , - ContentType + Content type } label="AVRO" /> } label="JSON" /> diff --git a/src/components/validateTopicForm.tsx b/src/components/validateTopicForm.tsx index 4f65082..f0877aa 100644 --- a/src/components/validateTopicForm.tsx +++ b/src/components/validateTopicForm.tsx @@ -93,9 +93,9 @@ function composeValidators(validators: Validator[]): Validate { export function validateTopicForm(values: TopicFormikValues, includeAdvanced: boolean): FormikErrors { const validate = composeValidators([ - validateRequired(["group", "topic", "description", "schema"]), + validateRequired(values.contentType === "AVRO" ? ["group", "topic", "description", "schema"] : ["group", "topic", "description"]), validateTopic, - validateSchema, + values.contentType === "AVRO" && validateSchema, includeAdvanced && validateMaxMessageSize, includeAdvanced && validateRetentionTime, ]);