Skip to content

Commit

Permalink
feat: indicate errors in JSON schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Twiineenock committed Aug 20, 2024
1 parent cca7bb8 commit 7a7d26f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/form-editor/form-editor.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ const FormEditorContent: React.FC<TranslationFnProps> = ({ t }) => {
<ErrorNotification error={clobdataError} title={t('schemaLoadError', 'Error loading schema')} />
) : null}
<div className={styles.editorContainer}>
{invalidJsonErrorMessage ? (
<InlineNotification
kind="error"
lowContrast
title={t('errorParsingJsonSchema', 'Error parsing JSON schema')}
subtitle={invalidJsonErrorMessage}
className={styles.jsonSchemaError}
/>
) : null}
<SchemaEditor
errors={errors}
isLoading={isLoadingFormOrSchema}
Expand Down
7 changes: 7 additions & 0 deletions src/components/form-editor/form-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
padding: 0;
}

.jsonSchemaError {
width: 100%;
max-width: unset;
padding: '0rem';
margin-bottom: 1rem;
}

.actionButtons {
display: flex;
align-items: center;
Expand Down
1 change: 1 addition & 0 deletions src/components/schema-editor/schema-editor.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const SchemaEditor: React.FC<SchemaEditorProps> = ({
setCurrentIndex(0);
onSchemaChange(newValue);
debouncedValidateSchema(newValue, schema);
setErrors([]);
};

// Schema Validation Errors
Expand Down

0 comments on commit 7a7d26f

Please sign in to comment.