This directory contains JSON schemas and documentation for the Cambridge Beer Festival data API.
| File | Description |
|---|---|
| beer-list-schema.json | JSON Schema for beverage data (beer, cider, mead, etc.) |
| festival-registry-schema.json | JSON Schema for festival configuration (data/festivals.json) |
| data-api-reference.md | Complete API reference documentation |
The festivals.json configuration file is automatically validated against the schema during CI builds. This ensures festival configuration changes are valid before deployment.
# Run validation locally
cd scripts
npm install
node validate-festivals.jsThe Cambridge Beer Festival app fetches beverage data from a public API:
- Base URL:
https://data.cambeerfestival.app - Format: JSON
- Authentication: None required (public API)
https://data.cambeerfestival.app/{festival_id}/{beverage_type}.json
# Beer data for CBF 2025
curl https://data.cambeerfestival.app/cbf2025/beer.json
# Cider data for CBF 2025
curl https://data.cambeerfestival.app/cbf2025/cider.json
# Winter festival beer data
curl https://data.cambeerfestival.app/cbfw2025/beer.jsonValidates the structure of beverage data responses. The schema defines:
- Root object with
timestampandproducersarray - Producer objects (breweries, cideries, etc.) with
name,location,products - Product objects (individual beverages) with
name,abv,category,dispense, etc.
| Field | Type | Description |
|---|---|---|
producers[].name |
string | Brewery/producer name |
producers[].location |
string | Geographic location |
producers[].products[].name |
string | Beverage name |
producers[].products[].abv |
string/number | Alcohol by volume |
producers[].products[].category |
string | "beer", "cider", "mead", etc. |
producers[].products[].dispense |
string | "cask", "keg", "bottle", etc. |
producers[].products[].allergens |
object | Allergen flags |
Validates festival configuration data. The schema defines:
- Registry with
version,last_updated, andfestivalsarray - Festival objects with
id,name,dates,location,metadata, anddata - Data configuration with
base_urlandavailable_types
This schema can be used in CI to validate changes to festival configuration.
const Ajv = require('ajv');
const addFormats = require('ajv-formats');
const schema = require('./beer-list-schema.json');
const ajv = new Ajv();
addFormats(ajv);
const validate = ajv.compile(schema);
const data = await fetch('https://data.cambeerfestival.app/cbf2025/beer.json')
.then(r => r.json());
if (validate(data)) {
console.log('Valid!');
} else {
console.log('Errors:', validate.errors);
}import json
import jsonschema
import requests
with open('beer-list-schema.json') as f:
schema = json.load(f)
data = requests.get('https://data.cambeerfestival.app/cbf2025/beer.json').json()
jsonschema.validate(data, schema) # Raises on error
print('Valid!')# Example GitHub Actions workflow
- name: Validate festival config
run: |
npm install ajv ajv-formats
node scripts/validate-schema.js| Category | Description | Typical Dispense |
|---|---|---|
beer |
Domestic ales and lagers | cask, keg |
foreign beer |
International beers | bottle, keg |
cider |
Apple ciders | cider tub |
perry |
Pear ciders | cider tub |
mead |
Honey wines | bottle, mead polypin |
wine |
Grape wines | bottle |
low-no |
Low/no alcohol beverages | various |
The allergens object in product data uses truthy values:
{
"allergens": {
"gluten": 1,
"sulphites": 1
}
}Common allergens tracked:
gluten- Contains glutensulphites- Contains sulphites
- BeerFestApp - Original Android app with full API docs
- Cambridge Beer Festival - Official festival website
Schemas follow the JSON Schema draft-07 specification. Breaking changes will result in new schema files with updated $id values.