trainlog/format/trainlog-v1.schema.json
2026-09-05 19:05:07 +02:00

253 lines
5.3 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://labfytools.com/trainlog/schema/trainlog-v1.schema.json",
"title": "Trainlog Exchange Format v1",
"type": "object",
"additionalProperties": false,
"required": [
"format",
"version",
"exercises",
"session"
],
"properties": {
"format": {
"const": "trainlog"
},
"version": {
"const": 1
},
"exercises": {
"type": "array",
"items": {
"$ref": "#/$defs/exerciseCatalogEntry"
}
},
"session": {
"$ref": "#/$defs/session"
}
},
"$defs": {
"exerciseId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[a-z0-9][a-z0-9_-]*$"
},
"exerciseCatalogEntry": {
"type": "object",
"additionalProperties": false,
"required": [
"exercise_id",
"name"
],
"properties": {
"exercise_id": {
"$ref": "#/$defs/exerciseId"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
}
},
"set": {
"type": "object",
"additionalProperties": false,
"properties": {
"reps": {
"type": "integer",
"minimum": 1,
"maximum": 10000
},
"duration_seconds": {
"type": "integer",
"minimum": 1,
"maximum": 86400
},
"weight_kg": {
"type": "number",
"minimum": 0,
"maximum": 5000
}
},
"anyOf": [
{
"required": [
"reps"
]
},
{
"required": [
"duration_seconds"
]
}
]
},
"target": {
"type": "object",
"additionalProperties": false,
"required": [
"sets"
],
"properties": {
"sets": {
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"reps": {
"type": "integer",
"minimum": 1,
"maximum": 10000
},
"duration_seconds": {
"type": "integer",
"minimum": 1,
"maximum": 86400
},
"weight_kg": {
"type": "number",
"minimum": 0,
"maximum": 5000
}
},
"anyOf": [
{
"required": [
"reps"
]
},
{
"required": [
"duration_seconds"
]
}
]
},
"sessionExercise": {
"type": "object",
"additionalProperties": false,
"required": [
"exercise_id",
"rest_seconds",
"target",
"sets"
],
"properties": {
"exercise_id": {
"$ref": "#/$defs/exerciseId"
},
"rest_seconds": {
"type": "integer",
"minimum": 0,
"maximum": 86400
},
"target": {
"$ref": "#/$defs/target"
},
"sets": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"$ref": "#/$defs/set"
}
}
}
},
"measurements": {
"type": "object",
"additionalProperties": false,
"properties": {
"waist_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"chest_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"shoulders_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"left_arm_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"right_arm_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"left_thigh_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"right_thigh_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"left_calf_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
},
"right_calf_cm": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 500
}
}
},
"session": {
"type": "object",
"additionalProperties": false,
"required": [
"session_id",
"started_at",
"ended_at",
"exercises"
],
"properties": {
"session_id": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"started_at": {
"type": "string",
"format": "date-time"
},
"ended_at": {
"type": "string",
"format": "date-time"
},
"body_weight_kg": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1000
},
"measurements": {
"$ref": "#/$defs/measurements"
},
"exercises": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"$ref": "#/$defs/sessionExercise"
}
}
}
}
}
}