File tree Expand file tree Collapse file tree
packages/slice-machine/src/legacy/lib/models/common/widgets/ContentRelationship Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,25 +8,26 @@ import WidgetFormField from "@/legacy/lib/builders/common/EditModal/Field";
88import { createFieldNameFromKey } from "@/legacy/lib/forms" ;
99import { DefaultFields } from "@/legacy/lib/forms/defaults" ;
1010
11+ const customTypesShape = yup . array (
12+ yup . object ( {
13+ id : yup . string ( ) ,
14+ fields : yup . array ( yup . string ( ) ) ,
15+ } ) ,
16+ ) ;
17+
1118const FormFields = {
1219 label : DefaultFields . label ,
1320 id : DefaultFields . id ,
1421 customtypes : {
15- validate : ( ) =>
16- yup . array (
17- yup . object ( {
18- id : yup . string ( ) ,
19- fields : yup . array ( yup . string ( ) ) ,
20- } ) ,
21- ) ,
22+ validate : ( ) => customTypesShape ,
2223 } ,
2324} ;
2425
2526type FormProps = {
2627 config : {
2728 label : string ;
2829 select : string ;
29- customtypes ?: { id : string ; fields : string [ ] } [ ] ;
30+ customtypes ?: yup . InferType < typeof customTypesShape > ;
3031 } ;
3132 id : string ;
3233 // TODO: this exists in the yup schema but this doesn't seem to be validated by formik
You can’t perform that action at this time.
0 commit comments