Merge pull request #14700 from alexrybch/validator-form-data

added formData to validation function
This commit is contained in:
Ben Lambert
2022-12-19 13:25:45 +01:00
committed by GitHub
4 changed files with 19 additions and 2 deletions
+15
View File
@@ -0,0 +1,15 @@
---
'@backstage/plugin-scaffolder': patch
---
Form data is now passed to validator functions in 'next' scaffolder, so it's now possible to perform validation for fields that depend on other field values. This is something that we discourage due to the coupling that it creates, but is sometimes still the most sensible solution.
```typescript jsx
export const myCustomValidation = (
value: string,
validation: FieldValidation,
{ apiHolder, formData }: { apiHolder: ApiHolder; formData: JsonObject },
) => {
// validate
};
```