apiaryio / gavel.js

Validator of HTTP messages (JavaScript implementation)
MIT License
97 stars 22 forks source link

Use built-in "validateSchema" instead of custom implementation #400

Open artem-zakharchenko opened 4 years ago

artem-zakharchenko commented 4 years ago

Currently JSON Schema validator class implements its own validateSchema method using AJV under the hood:

https://github.com/apiaryio/gavel.js/blob/5884b693ec652e2688c909a89d96c1363262306c/lib/validators/json-schema-next.js#L104-L121

With the same method implemented on the JsonSchemaLegacy class using TV4:

https://github.com/apiaryio/gavel.js/blob/5884b693ec652e2688c909a89d96c1363262306c/lib/validators/json-schema-legacy.js#L59-L72

I believe it's retained due to historical reasons and should be replaced with the build-in validateSchema option of AJV:

https://github.com/apiaryio/gavel.js/blob/5884b693ec652e2688c909a89d96c1363262306c/lib/validators/json-schema-next.js#L147-L155