Reputation: 13908
I'd like to know if I can define a schema to perform validation based on list of values at runtime. Example:
people:
- joe
- fred
- anna
bestfriend: ike
I'd like to define a schema where the value of bestfriend
is limited to the values of people
. The schema defines people
as array of string.
It looks a little like How to validate against runtime JSON object reference? where the answer is outdated.
Upvotes: 0
Views: 377
Reputation: 53996
No you cannot, but you could generate a new schema at runtime containing those values and then evaluate against that.
Upvotes: 1