Giter VIP home page Giter VIP logo

govuk-content-schemas's Introduction

GOV.UK content schemas

Content schemas have now been merged into publishing api so this repository is archived.

Background

This repo contains JSON Schema files and examples of the content that uses them on GOV.UK.

The actual JSON schema files live in dist and are generated from Jsonnet templates in source. Using templates makes it easier to duplicate common blocks across multiple schemas e.g. format and URL fields. Do not edit files in dist manually, as they will be overwritten.

Nomenclature

Schemas and examples are divided into three categories:

  • publisher_v2 - for when a publishing application transmits data to the content store
  • frontend - for data returned by the content store for a frontend application request
  • notification - for broadcasting messages about content items on the message queue

Technical documentation

You can use the GOV.UK Docker environment to run the tests with all the necessary dependencies. Follow the usage instructions to get started.

Use GOV.UK Docker to run any commands that follow.

Running the tests

Run the full test suite and linting:

bundle exec rake

Run the tests only:

bundle exec rake spec

Building the schemas

Use this to validate a change to the schemas, without having to run the tests.

bundle exec rake build

Further documentation

Licence

MIT Licence

govuk-content-schemas's People

Contributors

36degrees avatar alext avatar barrucadu avatar beckal avatar benlovell avatar boffbowsh avatar cbaines avatar chrisbashton avatar danielroseman avatar edwardkerry avatar elliotcm avatar emmabeynon avatar fofr avatar gpeng avatar h-lame avatar hannako avatar heathd avatar jamiecobbett avatar keithiopia avatar kevindew avatar leenagupte avatar rubenarakelyan avatar sihugh avatar steventux avatar suzannehamilton avatar tekin avatar thehenster avatar thomasleese avatar tijmenb avatar tommyp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

govuk-content-schemas's Issues

Travel advice alert status should be enum or removed

  • The alert status feature of travel advice isn't actively used, it could be removed from the publisher, schema and frontend
  • Alternatively, the alert status is set to one of a defined set of values, it should be an enum locked down to just those values.

https://github.com/alphagov/travel-advice-publisher/blob/5650462b5d11b7cc86d95c2f4e4470c8eaf71c9f/app/models/travel_advice_edition.rb#L30-L35

https://github.com/alphagov/govuk-content-schemas/blob/master/formats/travel_advice/publisher/details.json#L33-L37

Change history is ordered chronologically and in reverse

The frontend must display the change history in reverse chronological order. The document footer displays the most recent change note first.

Whitehall content items list change history in reverse chronological order:
Example: https://www.gov.uk/api/content/government/consultations/setting-the-grade-standards-of-new-gcses-in-england-2017-2018

Specialist publisher lists them chronologically, oldest first:
https://www.gov.uk/api/content/cma-cases/national-fostering-agency-acorn-care-1-merger-inquiry

We don't define in our definition which direction it should be, and I don't think JSON schema can enforce this:
https://github.com/alphagov/govuk-content-schemas/blob/master/formats/definitions.json#L339

Automate altering specialist-document schema details and examples

A suggested feature improvement for this process would be to somehow automate altering the schema details and examples. Perhaps triggered by changes to the specialist-publisher repo.

At present it's a manually intensive process to add or alter a specialist-document, but mostly following mechanical steps.

An automated mechanism to ensure these files stay in sync with the schema in specialist-publisher would also save time and effort.

Live specialist_document content item does not pass example validation

Attempting to update the aaib_report.json example with the currently live version for a prototype:

After updating and running bundle exec rake, the following error occurs:

vagrant@development:/var/govuk/govuk-content-schemas$ bundle exec rake
formats/specialist_document/frontend/examples/aaib-reports.json: had 1 error(s):
  The property '#/details/metadata' of type Hash did not match one or more of the required schemas. The schema specific errors were:

- anyOf #0:
    - The property '#/details/metadata' contains additional properties ["document_type"] outside of the schema when none are allowed
- anyOf #1:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #2:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #3:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #4:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #5:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #6:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #7:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #8:
    - The property '#/details/metadata/location' of type String did not match the following type: array
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #9:
    - The property '#/details/metadata/location' of type String did not match the following type: array
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #10:
    - The property '#/details/metadata/report_type' value "correspondence-investigation" did not match one of the following values: investigation-report, safety-bulletin, completed-preliminary-examination, overseas-report, discontinued-investigation
    - The property '#/details/metadata' contains additional properties ["aircraft_category", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #11:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #12:
    - The property '#/details/metadata/report_type' value "correspondence-investigation" did not match one of the following values: investigation-report, bulletin, interim-report, discontinuation-report, safety-digest
    - The property '#/details/metadata' contains additional properties ["aircraft_category", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #13:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #14:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
- anyOf #15:
    - The property '#/details/metadata' contains additional properties ["date_of_occurrence", "aircraft_category", "report_type", "location", "aircraft_type", "registration", "document_type"] outside of the schema when none are allowed
The following examples don't validate against their schemas:
formats/specialist_document/frontend/examples/aaib-reports.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.