I am trying to validate the below conditions in the sample response
- Based on 
subjectTypeattribute if it is eitherPersonorOrganization. - If 
subjectTypeis Person, check if it has abirthDateattribute 
Sample response:
{ 
 "subject": "ABC",    
 "subjectType": "Person",    
 "birthDate": "1951-03-07"
}, 
{ 
 "subject": "ABC",    
 "subjectType": "Organization"    
}
I tried this, but no luck.
def expected = {subjectType: 'Person', birthDate: '#present'}
def schema = { subjectType: '#? _ == "Person" || _ == "Organization"', birthDate: '#($.subjectType == "Person" ? "#present" : "#present")' }
match expected == schema
Any help is appreciated!