-
Notifications
You must be signed in to change notification settings - Fork 22
Using JsonSchema #35
Comments
Hi, gavel is not assuring json schema validity. There is no way how to validate schema itself in current gavel's API. It can be done by validating user provided schema against JSON Schema meta schema. |
Ok. Many thanks for your answer. |
Hi, I'm sorry I realised that's not bad idea at all to validate also schemas. I'll add it to gavel in next release. |
@netmilk I think Gavel should stay to be a tool to validate HTTP messages. To me, validating the schema seems to be a similar feature request as apiaryio/dredd#462 is for Dredd. |
Isn't JSON schema parsed/validated during the Gavel's validation by third-party validators (TV4, Amanda)? What is the status of this issue in regards to #90? If we adopt AJV, I expect it to throw upon invalid input. Gavel can handle that exception and, probably, present it in its public API. |
I think this should be handled by the validator. Gavel checks if JSON Schema is a valid JSON document, but the validator should check whether it is a valid schema document. If it does not (does Amanda do that?), Gavel can use that schema's meta schema to validate whether the document complies with the schema spec. And AFAIK Gavel already does that in some cases, or at least the meta schemas are for some reason part of the package. Since @netmilk's comment is from 2014, my hunch would be this has been implemented, but the issue accidentally wasn't closed. |
I confirm JSON schemas of V3 and V4 being validated by gavel.js/lib/validators/json-schema.js Lines 138 to 145 in 2eb036d
I would consider this issue closed. |
I'm having trouble using
JsonSchema
: when i use thevalidate
method, gavel seems to check for body identity : how can i only validate the schema ?Is there a reason why the
gavel
main module doesn't exportJsonSchema
?Many thanks for your help.
The text was updated successfully, but these errors were encountered: