Validating a value based on the properties of another object #581
Replies: 2 comments 3 replies
-
|
Hi. Unfortunately, matching against object keys the way you want isn't possible. There's a lot of ways to get values using my data vocab, but not keys. The problem is that there isn't a good way to query for keys. I think you're going to need to verify this in code. |
Beta Was this translation helpful? Give feedback.
-
|
Hi thanks for the quick answer. Do you think it would be possible in the future (of json schema) to have access to the keys, so my example can be validated? I think it may help validate more models. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've been searching for this answer for 2 days, even asked chatGPT but nothing seems to work.
I have this json example file:
{ "uids": { "a" : {}, "b" : {} }, "uid": "c" }I need a schema that will validate that the string value for the
uidproperty is one of the properties ofuids.In this example, it will fail since
cisn't any property ofuids(in this example, onlyaorbwould be valid). This is of course a dynamic validation.GPT offered me many things (including
$data,dependencies) but nothing validated when testing at https://json-everything.net/json-schema/Is it even possible (I don't mind using draft 2020-12), and if yes, how?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions