Skip to content

Schema Overview

openweight defines four JSON Schemas that together describe the full lifecycle of strength training data.

Schemas

SchemaPurposeStatus
WorkoutLogCompleted workout sessionsStable
WorkoutTemplatePlanned workout prescriptionsStable
ProgramMulti-week training programsStable
PersonalRecordsPersonal records and 1RM exportsStable

JSON Schema Version

All schemas use JSON Schema draft-07 for maximum compatibility with validation libraries.

Schema IDs

Each schema has a canonical $id for reference resolution:

Schema$id
WorkoutLoghttps://openweight.org/schemas/workout-log.schema.json
WorkoutTemplatehttps://openweight.org/schemas/workout-template.schema.json
Programhttps://openweight.org/schemas/program.schema.json
PersonalRecordshttps://openweight.org/schemas/personal-records.schema.json

Relationships

Program
  └── references → WorkoutTemplate (via $ref)

WorkoutLog
  └── optionally links to → WorkoutTemplate (via templateId)

A Program contains an array of weeks, each containing WorkoutTemplate objects (embedded via JSON Schema $ref).

A WorkoutLog can optionally reference the template it was created from using templateId, but this is informational only — the log stands alone as a complete record.

Extensibility

All schemas set additionalProperties: true, allowing apps to store custom fields:

json
{
  "date": "2024-01-15T09:30:00Z",
  "exercises": [
    ...
  ],
  "myapp:notes": "Felt strong today"
}

Use a namespaced prefix (e.g., myapp:) to avoid conflicts with future schema versions.

Validation

TypeScript

typescript
import {validateWorkoutLog} from '@openweight/sdk'

const result = validateWorkoutLog(data)
if (!result.valid) {
    console.log(result.errors)
}

Kotlin

kotlin
import com.openweight.validateWorkoutLog

val result = validateWorkoutLog(jsonElement)
if (!result.valid) {
    result.errors.forEach { println(it) }
}

Raw Schema Files

The canonical schema files are available in the repository:

Released under the Apache 2.0 License.