IanMayo/mustard — pull request #91 by anandod (2014-08-27 01:57:09+00:00)
Title: Feature/anand/grunt validation

I have added the schema validation to grunt. You can run it with 'grunt validate'.

There seems to be a bug with the 'json-schema' package which the grunt plugin 'grunt-json-schema' uses for validation.

The bug is that it shows
>> objectives[0].children[1].achievement is missing and it is required

even though 'achievement' is actually defined as not required. It appears to do this because the 'achievement' property has the following defined "required": ["name", "message"], (at line 333 of mission.json) for its sub properties. Removing this line clears the error, but we lose the required validation for achievement's name and message. This was the only bug with 'json-schema'.

There were a few validation failures due to some scenarios which didn't follow the schema correctly:

Errors in www/js/game/scenarios/1a_recognise_ownship.json
>> features is missing and it is required

Errors in www/js/game/scenarios/6a_drive_vessel.json
>> vessels[3].categories.type does not have a value in the enumeration WARSHIP,
>> SUBMARINE, MERCHANT, FISHING_VESSEL

Errors in www/js/game/scenarios/6b_merchant_and_fisherman.json
>> vessels[3].categories.type does not have a value in the enumeration WARSHIP,
>> SUBMARINE, MERCHANT, FISHING_VESSEL