diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4992f43 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,96 @@ +{ + "name": "data-api-docs", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "data-api-docs", + "version": "1.0.0", + "dependencies": { + "ajv": "^8.17.1" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ] + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + } + }, + "dependencies": { + "ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "requires": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==" + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..aeb195c --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "data-api-docs", + "version": "1.0.0", + "description": "", + "main": "index.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "validate": "node scripts/validate.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Pixellot/data-api-docs.git" + }, + "homepage": "https://github.com/Pixellot/data-api-docs#readme", + "dependencies": { + "ajv": "^8.17.1" + } +} diff --git a/schema.json b/schema.json index 321ade1..e5ecfe9 100644 --- a/schema.json +++ b/schema.json @@ -16,7 +16,7 @@ "description": "Version of the schema following semantic versioning (X.Y.Z)", "pattern": "^\\d+\\.\\d+\\.\\d+$", "examples": ["2.0.0"] - }, + }, "matchTeamStats": { "type": "object", "description": "Stats for the teams that participated in the game", @@ -318,9 +318,9 @@ "type": "object", "description": "A point of interest in a game which was logged, plus enriched data about the tag resource and tag attributes", "required": [ - "id", - "gameId", - "resource", + "id", + "gameId", + "resource", "attrs", "angles" ], @@ -406,7 +406,7 @@ "oneOf": [ { "type": "string" }, { "type": "number" }, - { + { "type": "array", "items": { "type": "string" @@ -414,9 +414,9 @@ } ], "examples": [ - "offense", - "6579de1d7e14a67a0e1a91bf", - "67a38884b62bf88b1146a82a", + "offense", + "6579de1d7e14a67a0e1a91bf", + "67a38884b62bf88b1146a82a", "50 John Cohen", "{\"x\":517.2781982421875,\"y\":311.42251586914062,\"x2\":0,\"y2\":0,\"type\":\"point\",\"sector\":11,\"orientation\":\"left\"}" ] @@ -534,6 +534,23 @@ } } }, + "fileAttributes": { + "type": "object", + "description": "Attributes describing the file", + "properties": { + "lastUpdatedAt": { + "type": "string", + "format": "date-time", + "description": "Last updated at date and time of the file in ISO 8601 format", + "examples": ["2025-09-25T02:00:00.000Z"] + }, + "lastUpdateReason": { + "type": "string", + "description": "Reason for the last update", + "examples": ["breakdown_completed"] + } + } + }, "eventAttributes": { "type": "object", "description": "Attributes describing the event/game", @@ -609,6 +626,34 @@ }, "required": ["id", "name"] }, + "league": { + "oneOf": [ + { + "type": "object", + "description": "League information", + "properties": { + "advantageId": { + "type": "string", + "description": "ID of the league in Advantage", + "examples": ["68af417a5b1a116e63804719"] + }, + "title": { + "type": "string", + "description": "Title of the league" + }, + "vidswapId": { + "type": "integer", + "description": "ID of the league in VidSwap", + "examples": [7627829] + } + }, + "required": ["advantageId", "title", "vidswapId"] + }, + { + "type": "null" + } + ] + }, "ids": { "type": "object", "description": "Various system IDs for the event", @@ -719,6 +764,11 @@ "priority": { "type": "integer", "description": "Priority of the breakdown (integer number). Optional field" + }, + "loggerNotes": { + "type": "string", + "description": "Notes from the logger", + "examples": ["This game was logged on VidSwap"] } } }, @@ -747,13 +797,12 @@ "type": "string", "description": "URL to the recorded video stream", "format": "uri", - "examples": ["https://d2s0txx1aqnj4f.cloudfront.net/someTenantName/6736d0dc4c7136f9b31f0269/cloud_hls/0_hd_hls.m3u8"] + "examples": ["https://d2s0txx1aqnj4f.cloudfront.net/someTenantName/6736d0dc4c7136f9b31f0269/cloud_hls/0_hd_hls.m3u8"] }, - "startUtc": { - "type": "string", - "format": "date-time", + "startUTC": { + "type": "integer", "description": "Indicator of event start time in UTC format", - "examples": ["2025-05-01T12:00:00.000Z"] + "examples": [1739552865] } } } diff --git a/scripts/validate.js b/scripts/validate.js new file mode 100644 index 0000000..98e7e7d --- /dev/null +++ b/scripts/validate.js @@ -0,0 +1,16 @@ +'use strict'; + +const Ajv = require('ajv'); + +const ajv = new Ajv(); + +const scheme = require('../schema.json'); + +const isValidSchema = ajv.validateSchema(scheme); + +if (!isValidSchema) { + console.log('Schema is invalid'); + console.log(ajv.errors); +} else { + console.log('Schema is valid'); +}