Skip to content

Commit

Permalink
fix: problem with json content type validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzuming committed Oct 17, 2024
1 parent 61f8307 commit 01f9a5a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/editTopicDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const EditTopicDialog = observer(() => {
<Field required component={TextField} label="Topic name" name="topic" key="topic" fullWidth disabled />,
<Field required component={TextField} autoFocus label="Topic description" name="description" key="description" fullWidth />,
<FormControl key="contentType">
<FormLabel>ContentType</FormLabel>
<FormLabel>Content type</FormLabel>
<Field as={RadioGroup} row name={"contentType"}>
<FormControlLabel value="AVRO" control={<Radio />} label="AVRO" />
<FormControlLabel value="JSON" control={<Radio />} label="JSON" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/topicDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const TopicDialog = observer(
<Field autoFocus required component={TextField} label="Topic name" name="topic" key="topic" fullWidth />,
<Field required component={TextField} label="Topic description" name="description" key="description" fullWidth />,
<FormControl key="contentType">
<FormLabel>ContentType</FormLabel>
<FormLabel>Content type</FormLabel>
<Field as={RadioGroup} row name={"contentType"}>
<FormControlLabel value="AVRO" control={<Radio />} label="AVRO" />
<FormControlLabel value="JSON" control={<Radio />} label="JSON" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/validateTopicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ function composeValidators<T>(validators: Validator<T>[]): Validate<T> {

export function validateTopicForm(values: TopicFormikValues, includeAdvanced: boolean): FormikErrors<TopicFormikValues> {
const validate = composeValidators<TopicFormikValues>([
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,
]);
Expand Down

0 comments on commit 01f9a5a

Please sign in to comment.