-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend user-defined keywords' context #68
Comments
see the example line 25 shows how it extracted the value of the custom keyword |
got it. you need the location the the json document that is being verified. the library don't ask for the document location. the user parses the json himself and calls |
Well, here an example: {
"$id": "https://some.doc/doc1",
"links": [
"link": {
"ref": "some/data-model.json"
}
]
} I want to validate that the "ref" is referencing to an existing document. For that I need to construct full URL: |
assuming the example you have provided is instance document, you want to validate |
Again, I don't really need an instance location. I need an access to currently validated document (in addition to currently validated value) so I can extract the value from "$id" property. For example above, simplified schema could be: "$id": {
"type": "string",
"format": "uri"
}
"links": {
"type": "array",
"items": {
"type": "string",
"format": "uri-schema",
"validJson": true
}
} Where "validJson" is my custom keyword. |
you are actually trying to validate the document that is being referred to using I do not think i can pass the while instance document for validation(currently only the portion that is documented is passed) I can suggest a workaround. since each instance document has single |
I currently use the workaround you mentioned, however I thought that it could be useful to have the whole document during the validation. This will add more possibilities for custom keywords.
|
problem is: otherwise, I have to modify |
yep, it looks it can't be done without modification of |
I'm trying to define a keyword to validate uri-reference (e.g. for "data/client.json" make sure that client.json file exists and it is a valid json schema.
Current context for user-defined keyword contains only current data, without information about the current document. So it is not possible to validate the desired logic.
Do you think it is possible to extend the context with document location uri/document itself?
I can image that this can be useful for other validation types too.
The text was updated successfully, but these errors were encountered: