alphagov/govuk-content-schemas — pull request #9 by heathd (2014-12-16 15:00:20+00:00)
Title: Frontend schema generator

This pull request adds:

* `bin/generate_frontend_schema` to generate the frontend schema from the publisher schema
* `bin/validate` to validate a frontend example against a frontend schema

Generating the frontend schema from the backend schema allows us to verify the examples using this auto-generated frontend schema and be confident that the examples correspond to what would be fetched from the content-store.

This PR also includes a `Makefile` to tie together all these processes. Here's an example usage of the makefile:

```
$ make clean
rm -f formats/case_study/frontend/examples/archived.json.valid formats/case_study/frontend/examples/case_study.json.valid formats/case_study/frontend/examples/translated.json.valid
rm -f formats/case_study/frontend/schema.json
rm -f formats/case_study/publisher/schema.json
$ make
bundle exec ./bin/combine_publisher_schema formats/case_study/publisher/
bundle exec ./bin/generate_frontend_schema formats/case_study/publisher/schema.json > formats/case_study/frontend/schema.json
bundle exec ./bin/validate formats/case_study/frontend/examples/archived.json && touch formats/case_study/frontend/examples/archived.json.valid
formats/case_study/frontend/examples/archived.json: OK
bundle exec ./bin/validate formats/case_study/frontend/examples/case_study.json && touch formats/case_study/frontend/examples/case_study.json.valid
formats/case_study/frontend/examples/case_study.json: OK
bundle exec ./bin/validate formats/case_study/frontend/examples/translated.json && touch formats/case_study/frontend/examples/translated.json.valid
formats/case_study/frontend/examples/translated.json: OK
```

To review this PR I'd suggest starting with the `README.md`, then look at the specs and finally the implementation.