-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) Form validator built into interactive form builder #172
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Jammie! My general comment is: let's separate concerns here. Let's have the validation logic to exist independent of the interactive builder component in-order to keep this component simple.
src/components/interactive-builder/interactive-builder.component.tsx
Outdated
Show resolved
Hide resolved
src/components/interactive-builder/interactive-builder.component.tsx
Outdated
Show resolved
Hide resolved
src/components/interactive-builder/interactive-builder.component.tsx
Outdated
Show resolved
Hide resolved
src/components/interactive-builder/interactive-builder.component.tsx
Outdated
Show resolved
Hide resolved
const validateForm = () => { | ||
handleFormValidation(schema).then(response => { | ||
const [questionResolutionsArray, answersResolutionsArray] = response | ||
setResponses(questionResolutionsArray) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other way of injecting the validator would be through a hook:
// the validator runs if doValidate is set to true
// isValidating shows the validation status
const { errors, warnings, isValidating } = useSchemaValidationResults(doValidate, schema);
@arodidev FYI: All the checks are failing |
…penmrs-esm-form-builder into feat/schema-validator
@arodidev Did you see the build failure |
commit 3315b3a Author: arodidev <[email protected]> Date: Mon Aug 14 13:32:46 2023 +0300 Moved validation state to parent component
@@ -163,6 +168,7 @@ const FormEditor: React.FC = () => { | |||
schema={schema} | |||
onSchemaChange={updateSchema} | |||
isLoading={isLoadingFormOrSchema} | |||
validateStateSetter={validationSetter} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateStateSetter={validationSetter} | |
validateStateSetter={setIsValidating} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I would rename validateStateSetter
to setIsValidating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issues cited have been resolved, kindly review @samuelmale
@denniskigen can you kindly have a look at this? |
Summary
A validation tool that validates whether forms have UUIDS, checks for concepts used the in forms in the backend using the concept UUID or concept mappings provided in the form, and validates whether the datatype on the concepts align with the control type assigned in the form.
Screenshots