AdamVig / GoCoApi

API Server for the GoCoStudent app.
https://gocostudent.adamvig.com/api
GNU General Public License v3.0
0 stars 0 forks source link

Add API schema validation tests #7

Closed AdamVig closed 8 years ago

AdamVig commented 8 years ago

The current regression test only checks for 200 OK responses, but does not check if the returned data is in the correct format or of the correct type.

Looks like Chai has a plugin called chai-json-schema that would integrate well with the existing tests written with Mocha.

AdamVig commented 8 years ago

Use Prmd to document the API after creating the JSON schema to validate against.

AdamVig commented 8 years ago

Decided against using Prmd because it is a Ruby Gem and there is no drop-in Node alternative. A better long-term solution is to use Swagger to define the API, provide validation, and create documentation. This is outside of the scope of this issue, so I am putting it off until a need for documentation arises.