santhosh-tekuri/jsonschema

Possibility to reference other parts of the document

Closed this issue · 3 comments

With ajv I can reference other parts of the JSON document via the $data keyword.
Would that be possible with this library as well?
Or would it be possible to define it as a separate custom keyword, maybe?

thanks!

It is not possible to use $data in standard keywords as in ajv. But you can create custom keyword. Extension.Validate gets the part of instance that is getting validated.

so I'd use the current value (=string containing a JSONPath or JSONPointer or similar), resolve it against the instance and validate it that way myself, correct?

Yes. You are correct