GOV.UK Schemas

Gem to work with the govuk-content-schemas.


In your Gemfile:

gem "govuk_schemas", "~> VERSION"


  • The gem doesn't support patternProperties yet. On GOV.UK we use this in the expanded frontend links.
  • It's complicated to generate random data for oneOf properties. According to the JSON Schema spec a oneOf schema is only valid if the data is valid against only one of the clauses. To do this properly, we'd have to make sure that the data generated below doesn't validate against the other schemas properties.


Read the documentation!

Running the test suite

Make sure you have govuk-content-schemas cloned in a sibling directory:

bundle exec rake


To run a Yard server locally to preview documentation, run:

$ bundle exec yard server --reload

To rebuild the documentation, run:

$ bundle exec rake yard

Releasing the gem

This gem uses gem_publisher. Updating the version will automatically release a new version to Rubygems.


The gem is available as open source under the terms of the MIT License.