File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed
Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change 99 defineFormConditional ,
1010 errorMessages
1111} from '@opencrvs/toolkit/events'
12- import { type } from 'os'
1312
1413function isInternationalAddress ( ) {
1514 return and (
@@ -43,12 +42,33 @@ export function getNestedFieldValidators(
4342 [ fieldId ] : {
4443 type : 'object' ,
4544 properties : {
46- [ field . id ] : {
47- minLength : 1
45+ addressType : {
46+ type : 'string' ,
47+ enum : [ 'INTERNATIONAL' , 'DOMESTIC' ]
48+ } ,
49+ streetLevelDetails : {
50+ type : 'object' ,
51+ properties : {
52+ [ field . id ] : { minLength : 1 }
53+ }
54+ }
55+ } ,
56+ if : {
57+ properties : {
58+ addressType : { const : 'INTERNATIONAL' }
59+ }
60+ } ,
61+ then : {
62+ required : [ 'streetLevelDetails' ] ,
63+ properties : {
64+ streetLevelDetails : {
65+ required : [ field . id ]
66+ }
4867 }
4968 }
5069 }
51- }
70+ } ,
71+ required : [ fieldId ]
5272 } )
5373 } ) )
5474}
You can’t perform that action at this time.
0 commit comments