feat: add new issue trigger in GitHub

This commit is contained in:
Ali BARIN
2022-05-07 23:04:29 +02:00
parent 54152a3564
commit 3a63fc376d
9 changed files with 230 additions and 8 deletions

View File

@@ -69,11 +69,13 @@ function generateValidationSchema(substeps: ISubstep[]) {
// if the field depends on another field, add the dependsOn required validation
if (dependsOn?.length > 0) {
for (const dependsOnKey of dependsOn) {
const missingDependencyValueMessage = `We're having trouble loading '${key}' data as required field '${dependsOnKey}' is missing.`;
// TODO: make `dependsOnKey` agnostic to the field. However, nested validation schema is not supported.
// So the fields under the `parameters` key are subject to their siblings only and thus, `parameters.` is removed.
substepArgumentValidations[key] = substepArgumentValidations[key].when(`${dependsOnKey.replace('parameters.', '')}`, {
is: (value: string) => Boolean(value) === false,
then: (schema) => schema.required(`We're having trouble loading '${key}' data as required field '${dependsOnKey}' is missing.`),
then: (schema) => schema.notOneOf([''], missingDependencyValueMessage).required(missingDependencyValueMessage),
});
}
}