From 4193c18aedafb66e5b52324f28fe0d770c73b69e Mon Sep 17 00:00:00 2001 From: Trevor Fitzgerald Date: Thu, 7 Nov 2024 22:08:10 -0500 Subject: [PATCH] Update study schemas --- doc/specs/schemas/StudyImportPgnChapters.yaml | 54 ++++++++++++++++++- doc/specs/schemas/StudyMetadata.yaml | 25 ++++++++- .../tags/broadcasts/api-broadcasts-top.yaml | 2 +- doc/specs/tags/games/api-import.yaml | 11 +++- .../tags/studies/api-study-by-username.yaml | 4 +- 5 files changed, 89 insertions(+), 7 deletions(-) diff --git a/doc/specs/schemas/StudyImportPgnChapters.yaml b/doc/specs/schemas/StudyImportPgnChapters.yaml index 39cdd0a..09c54cc 100644 --- a/doc/specs/schemas/StudyImportPgnChapters.yaml +++ b/doc/specs/schemas/StudyImportPgnChapters.yaml @@ -1 +1,53 @@ -example: { 'chapters': [{ 'id': 'WTvnkWAL', 'name': 'Game 2' }] } +type: object + +properties: + chapters: + type: array + items: + type: object + properties: + id: + type: string + description: The chapter ID + name: + type: string + description: The chapter name + players: + type: array + minItems: 2 + maxItems: 2 + items: + type: object + properties: + name: + type: + - string + - "null" + description: The player name + rating: + type: integer + description: The player rating + status: + type: string + description: The chapter status + +example: + { + "chapters": [ + { + "id": "iBjmYBya", + "name": "test 2", + "players": [ + { + "name": "Carlsen, Magnus", + "rating": 2837 + }, + { + "name": "Chadaev, Nikolay", + "rating": 2580 + } + ], + "status": "1-0" + } + ] + } diff --git a/doc/specs/schemas/StudyMetadata.yaml b/doc/specs/schemas/StudyMetadata.yaml index af786f3..d2454bb 100644 --- a/doc/specs/schemas/StudyMetadata.yaml +++ b/doc/specs/schemas/StudyMetadata.yaml @@ -1,2 +1,25 @@ +type: object + +properties: + id: + type: string + description: The study ID + name: + type: string + description: The study name + createdAt: + type: integer + format: int64 + description: The study creation date + updatedAt: + type: integer + format: int64 + description: The study last update date + example: - { 'id': 'WTvnkWAL', 'name': 'Guess the move', 'createdAt': 1463756350225, 'updatedAt': 1469965025205 } + { + "id": "WTvnkWAL", + "name": "Guess the move", + "createdAt": 1463756350225, + "updatedAt": 1469965025205 + } diff --git a/doc/specs/tags/broadcasts/api-broadcasts-top.yaml b/doc/specs/tags/broadcasts/api-broadcasts-top.yaml index 21eb58c..9114db2 100644 --- a/doc/specs/tags/broadcasts/api-broadcasts-top.yaml +++ b/doc/specs/tags/broadcasts/api-broadcasts-top.yaml @@ -30,6 +30,6 @@ get: type: string default: "'*'" content: - application/x-ndjson: + application/json: schema: $ref: "../../schemas/BroadcastTop.yaml" diff --git a/doc/specs/tags/games/api-import.yaml b/doc/specs/tags/games/api-import.yaml index 43da4b7..121fb59 100644 --- a/doc/specs/tags/games/api-import.yaml +++ b/doc/specs/tags/games/api-import.yaml @@ -33,5 +33,14 @@ post: content: application/json: schema: + type: object + properties: + id: + type: string + description: The game ID + example: "R6iLjwz5" + url: + type: string + format: uri + description: The game URL example: {"id": "R6iLjwz5", "url": "https://lichess.org/R6iLjwz5"} - diff --git a/doc/specs/tags/studies/api-study-by-username.yaml b/doc/specs/tags/studies/api-study-by-username.yaml index a9306b5..c57aee0 100644 --- a/doc/specs/tags/studies/api-study-by-username.yaml +++ b/doc/specs/tags/studies/api-study-by-username.yaml @@ -28,6 +28,4 @@ get: content: application/x-ndjson: schema: - type: array - items: - $ref: '../../schemas/StudyMetadata.yaml' + $ref: '../../schemas/StudyMetadata.yaml'