nhs-notify-standards

NHS Notify – CloudEvents Standards

This folder contains the NHS Notify CloudEvents standards, which define the structure and requirements for event-driven messaging in the NHS Notify ecosystem.

Overview

CloudEvents is a specification for describing event data in a common way. The NHS Notify CloudEvents standards provide:

Key Files

Schema Docs

Generated static documentation (once you run npm run docs) will appear under docs/.

Generating Example Data

To generate example data from a schema, use the provided Makefile target:

make generate-default

To validate:

make validate

This will run the generator and create a file locally in the output folder.

Usage

  1. Validate CloudEvents:
    • Use the provided JSON Schema to validate your CloudEvent payloads for NHS Notify compatibility.
    • Example (using the included Node.js script, which supports draft 2020-12):
       node validate.js nhs-notify-profile.schema.json output-example-event.json
      
    • The script will print validation errors if the data is invalid.
  2. Reference Examples:
    • Use the example files as templates for constructing your own events.
  3. Extend or Reuse:
    • The common/nhs/ directory contains reusable schema components for NHS identifiers and codes.

Development

Schema Documentation

Static HTML documentation for the JSON Schemas can be generated using json-schema-static-docs.

Generate docs (outputs to docs/):

npm install   # first time only to install the new dev dependency
npm run docs

Then open docs/index.html in a browser (or host the folder via GitHub Pages if desired).

If you add a new schema file, update the docs script in package.json to include an additional -i <filename> argument.