File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,8 +28,17 @@ export const createHeadlessForm = (
2828 options ?: { jsfModify ?: JSFModify } ,
2929) : CreateHeadlessFormResult => {
3030 if ( options && options . jsfModify ) {
31- const { schema } = modify ( jsfSchema , options . jsfModify ) ;
31+ const { required, allOf, ...modifyConfig } = options . jsfModify ;
32+ const { schema } = modify ( jsfSchema , modifyConfig ) ;
3233 jsfSchema = schema ;
34+
35+ if ( required ) {
36+ jsfSchema . required = [ ...schema . required , ...required ] ;
37+ }
38+
39+ if ( allOf ) {
40+ jsfSchema . allOf = [ ...( schema . allOf || [ ] ) , ...allOf ] ;
41+ }
3342 }
3443
3544 let moneyFieldsData : Record < string , number | null > = { } ;
Original file line number Diff line number Diff line change @@ -74,7 +74,16 @@ export type JSONSchemaFormType =
7474 // Benefits forms
7575 | 'benefit_renewal_request' ;
7676
77- export type JSFModify = ModifyConfig ;
77+ export type JSFModify = ModifyConfig & {
78+ /**
79+ * allows to specify additional required fields for the form.
80+ */
81+ required ?: string [ ] ;
82+ /**
83+ * allows to specify additional allOf rules for the form.
84+ */
85+ allOf ?: unknown [ ] ;
86+ } ;
7887
7988export type FlowOptions = {
8089 jsfModify ?: JSFModify ;
You can’t perform that action at this time.
0 commit comments