From bd2fe6797960c7f71884e43c70ee1bcefae8eff6 Mon Sep 17 00:00:00 2001 From: tors42 <4084220+tors42@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:20:32 +0200 Subject: [PATCH 1/4] Remove examples-component --- doc/specs/examples/_index.yaml | 47 ---------------------------------- doc/specs/lichess-api.yaml | 4 --- 2 files changed, 51 deletions(-) delete mode 100644 doc/specs/examples/_index.yaml diff --git a/doc/specs/examples/_index.yaml b/doc/specs/examples/_index.yaml deleted file mode 100644 index d8c548c..0000000 --- a/doc/specs/examples/_index.yaml +++ /dev/null @@ -1,47 +0,0 @@ -challenge: - $ref: './challenge.yaml' - -challengeCanceled: - $ref: './challengeCanceled.yaml' - -challengeDeclined: - $ref: './challengeDeclined.yaml' - -gameStart: - $ref: './gameStart.yaml' - -gameFinish: - $ref: './gameFinish.yaml' - -gameFull: - $ref: './gameFull.yaml' - -gameState: - $ref: './gameState.yaml' - -chatLine: - $ref: './chatLine.yaml' - -chatLineSpectator: - $ref: './chatLineSpectator.yaml' - -opponentGoneTrue: - $ref: './opponentGoneTrue.yaml' - -opponentGoneFalse: - $ref: './opponentGoneFalse.yaml' - -gameStateResign: - $ref: './gameStateResign.yaml' - -broadcastPgnPushRequest: - $ref: './broadcastPgnPushRequest.yaml' - -broadcastPgnPushResponse: - $ref: './broadcastPgnPushResponse.yaml' - -tvFeedFirst: - $ref: './tvFeedFirst.yaml' - -tvFeedFen: - $ref: './tvFeedFirst.yaml' diff --git a/doc/specs/lichess-api.yaml b/doc/specs/lichess-api.yaml index a5fe5f2..6caae10 100644 --- a/doc/specs/lichess-api.yaml +++ b/doc/specs/lichess-api.yaml @@ -715,7 +715,3 @@ components: "board:play": Play with the Board API "bot:play": Play with the Bot API. Only for [Bot accounts](#operation/botAccountUpgrade) "web:mod": Use moderator tools (within the bounds of your permissions) - - examples: - $ref: './examples/_index.yaml' - From 8525a558a79946b476149650b7f19fed307c1bb5 Mon Sep 17 00:00:00 2001 From: tors42 <4084220+tors42@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:44:52 +0200 Subject: [PATCH 2/4] Fix Board/Bot event stream + game stream examples /#tag/Bot/operation/apiStreamEvent /#tag/Bot/operation/botGameStream /#tag/Board/operation/apiStreamEvent /#tag/Board/operation/boardGameStream Refactor examples sections, from listing each example explicitly (from examples/*.yaml) to instead make each schema reference its own example (as examples/*.json). --- .../examples/{challenge.yaml => challenge.json} | 2 +- ...llengeCanceled.yaml => challengeCanceled.json} | 2 +- ...llengeDeclined.yaml => challengeDeclined.json} | 2 +- .../examples/{chatLine.yaml => chatLine.json} | 2 +- doc/specs/examples/chatLineSpectator.yaml | 6 ------ .../examples/{gameFinish.yaml => gameFinish.json} | 2 +- .../examples/{gameFull.yaml => gameFull.json} | 2 +- .../examples/{gameStart.yaml => gameStart.json} | 2 +- .../examples/{gameState.yaml => gameState.json} | 2 +- doc/specs/examples/gameStateResign.yaml | 10 ---------- .../{opponentGoneTrue.yaml => opponentGone.json} | 2 +- doc/specs/examples/opponentGoneFalse.yaml | 4 ---- doc/specs/schemas/ChallengeCanceledEvent.yaml | 2 ++ doc/specs/schemas/ChallengeDeclinedEvent.yaml | 2 ++ doc/specs/schemas/ChatLineEvent.yaml | 2 ++ doc/specs/schemas/GameFinishEvent.yaml | 2 ++ doc/specs/schemas/GameFullEvent.yaml | 2 ++ doc/specs/schemas/GameStartEvent.yaml | 2 ++ doc/specs/schemas/GameStateEvent.yaml | 2 ++ doc/specs/schemas/OpponentGone.yaml | 2 ++ .../tags/board/api-board-game-stream-gameId.yaml | 15 --------------- doc/specs/tags/board/api-stream-event.yaml | 11 ----------- .../tags/bot/api-bot-game-stream-gameId.yaml | 15 --------------- 23 files changed, 25 insertions(+), 70 deletions(-) rename doc/specs/examples/{challenge.yaml => challenge.json} (98%) rename doc/specs/examples/{challengeCanceled.yaml => challengeCanceled.json} (99%) rename doc/specs/examples/{challengeDeclined.yaml => challengeDeclined.json} (99%) rename doc/specs/examples/{chatLine.yaml => chatLine.json} (91%) delete mode 100644 doc/specs/examples/chatLineSpectator.yaml rename doc/specs/examples/{gameFinish.yaml => gameFinish.json} (98%) rename doc/specs/examples/{gameFull.yaml => gameFull.json} (98%) rename doc/specs/examples/{gameStart.yaml => gameStart.json} (98%) rename doc/specs/examples/{gameState.yaml => gameState.json} (95%) delete mode 100644 doc/specs/examples/gameStateResign.yaml rename doc/specs/examples/{opponentGoneTrue.yaml => opponentGone.json} (88%) delete mode 100644 doc/specs/examples/opponentGoneFalse.yaml diff --git a/doc/specs/examples/challenge.yaml b/doc/specs/examples/challenge.json similarity index 98% rename from doc/specs/examples/challenge.yaml rename to doc/specs/examples/challenge.json index 395f8bd..69a1760 100644 --- a/doc/specs/examples/challenge.yaml +++ b/doc/specs/examples/challenge.json @@ -1,4 +1,4 @@ -value: { +{ "type":"challenge", "challenge": { "id":"7pGLxJ4F", diff --git a/doc/specs/examples/challengeCanceled.yaml b/doc/specs/examples/challengeCanceled.json similarity index 99% rename from doc/specs/examples/challengeCanceled.yaml rename to doc/specs/examples/challengeCanceled.json index 1662bfc..ad71483 100644 --- a/doc/specs/examples/challengeCanceled.yaml +++ b/doc/specs/examples/challengeCanceled.json @@ -1,4 +1,4 @@ -value: { +{ "type":"challengeCanceled", "challenge": { "id":"7pGLxJ4F", diff --git a/doc/specs/examples/challengeDeclined.yaml b/doc/specs/examples/challengeDeclined.json similarity index 99% rename from doc/specs/examples/challengeDeclined.yaml rename to doc/specs/examples/challengeDeclined.json index a13b3be..dbf50f0 100644 --- a/doc/specs/examples/challengeDeclined.yaml +++ b/doc/specs/examples/challengeDeclined.json @@ -1,4 +1,4 @@ -value: { +{ "type": "challengeDeclined", "challenge": { "id":"7pGLxJ4F", diff --git a/doc/specs/examples/chatLine.yaml b/doc/specs/examples/chatLine.json similarity index 91% rename from doc/specs/examples/chatLine.yaml rename to doc/specs/examples/chatLine.json index 96dee8e..ce0f810 100644 --- a/doc/specs/examples/chatLine.yaml +++ b/doc/specs/examples/chatLine.json @@ -1,4 +1,4 @@ -value: { +{ "type": "chatLine", "username": "thibault", "text": "Good luck, have fun", diff --git a/doc/specs/examples/chatLineSpectator.yaml b/doc/specs/examples/chatLineSpectator.yaml deleted file mode 100644 index dc5ccef..0000000 --- a/doc/specs/examples/chatLineSpectator.yaml +++ /dev/null @@ -1,6 +0,0 @@ -value: { - "type": "chatLine", - "username": "lovlas", - "text": "!eval", - "room": "spectator" -} diff --git a/doc/specs/examples/gameFinish.yaml b/doc/specs/examples/gameFinish.json similarity index 98% rename from doc/specs/examples/gameFinish.yaml rename to doc/specs/examples/gameFinish.json index 989955f..87f98a1 100644 --- a/doc/specs/examples/gameFinish.yaml +++ b/doc/specs/examples/gameFinish.json @@ -1,4 +1,4 @@ -value: { +{ "type":"gameFinish", "game": { "gameId": "rCRw1AuO", diff --git a/doc/specs/examples/gameFull.yaml b/doc/specs/examples/gameFull.json similarity index 98% rename from doc/specs/examples/gameFull.yaml rename to doc/specs/examples/gameFull.json index 6feac30..3ed2fd4 100644 --- a/doc/specs/examples/gameFull.yaml +++ b/doc/specs/examples/gameFull.json @@ -1,4 +1,4 @@ -value: { +{ "type": "gameFull", "id": "5IrD6Gzz", "rated": true, diff --git a/doc/specs/examples/gameStart.yaml b/doc/specs/examples/gameStart.json similarity index 98% rename from doc/specs/examples/gameStart.yaml rename to doc/specs/examples/gameStart.json index 955d604..84ed7f2 100644 --- a/doc/specs/examples/gameStart.yaml +++ b/doc/specs/examples/gameStart.json @@ -1,4 +1,4 @@ -value: { +{ "type":"gameStart", "game": { "gameId": "rCRw1AuO", diff --git a/doc/specs/examples/gameState.yaml b/doc/specs/examples/gameState.json similarity index 95% rename from doc/specs/examples/gameState.yaml rename to doc/specs/examples/gameState.json index f7b94ad..df8ba08 100644 --- a/doc/specs/examples/gameState.yaml +++ b/doc/specs/examples/gameState.json @@ -1,4 +1,4 @@ -value: { +{ "type": "gameState", "moves": "e2e4 c7c5 f2f4 d7d6 g1f3 b8c6 f1c4 g8f6 d2d3 g7g6 e1g1 f8g7 b1c3", "wtime": 7598040, diff --git a/doc/specs/examples/gameStateResign.yaml b/doc/specs/examples/gameStateResign.yaml deleted file mode 100644 index ff667fc..0000000 --- a/doc/specs/examples/gameStateResign.yaml +++ /dev/null @@ -1,10 +0,0 @@ -value: { - "type": "gameState", - "moves": "e2e4 c7c5 f2f4 d7d6 g1f3 b8c6 f1c4 g8f6 d2d3 g7g6 e1g1 f8g7 b1c3", - "wtime": 7598040, - "btime": 8395220, - "winc": 10000, - "binc": 10000, - "status": "resign", - "winner": "black" -} diff --git a/doc/specs/examples/opponentGoneTrue.yaml b/doc/specs/examples/opponentGone.json similarity index 88% rename from doc/specs/examples/opponentGoneTrue.yaml rename to doc/specs/examples/opponentGone.json index 791a2bd..fc821ba 100644 --- a/doc/specs/examples/opponentGoneTrue.yaml +++ b/doc/specs/examples/opponentGone.json @@ -1,4 +1,4 @@ -value: { +{ "type": "opponentGone", "gone": true, "claimWinInSeconds": 8 diff --git a/doc/specs/examples/opponentGoneFalse.yaml b/doc/specs/examples/opponentGoneFalse.yaml deleted file mode 100644 index cc2fc70..0000000 --- a/doc/specs/examples/opponentGoneFalse.yaml +++ /dev/null @@ -1,4 +0,0 @@ -value: { - "type": "opponentGone", - "gone": false -} diff --git a/doc/specs/schemas/ChallengeCanceledEvent.yaml b/doc/specs/schemas/ChallengeCanceledEvent.yaml index 65a8ebd..0da2934 100644 --- a/doc/specs/schemas/ChallengeCanceledEvent.yaml +++ b/doc/specs/schemas/ChallengeCanceledEvent.yaml @@ -5,3 +5,5 @@ properties: const: challengeCanceled challenge: $ref: './ChallengeJson.yaml' +example: + $ref: '../examples/challengeCanceled.json' diff --git a/doc/specs/schemas/ChallengeDeclinedEvent.yaml b/doc/specs/schemas/ChallengeDeclinedEvent.yaml index db005bf..d3d761c 100644 --- a/doc/specs/schemas/ChallengeDeclinedEvent.yaml +++ b/doc/specs/schemas/ChallengeDeclinedEvent.yaml @@ -5,3 +5,5 @@ properties: const: challengeDeclined challenge: $ref: './ChallengeCanceledJson.yaml' +example: + $ref: '../examples/challengeDeclined.json' diff --git a/doc/specs/schemas/ChatLineEvent.yaml b/doc/specs/schemas/ChatLineEvent.yaml index bf2b717..841cdaa 100644 --- a/doc/specs/schemas/ChatLineEvent.yaml +++ b/doc/specs/schemas/ChatLineEvent.yaml @@ -17,3 +17,5 @@ required: - room - username - text +example: + $ref: '../examples/chatLine.json' diff --git a/doc/specs/schemas/GameFinishEvent.yaml b/doc/specs/schemas/GameFinishEvent.yaml index a82faf2..88963d1 100644 --- a/doc/specs/schemas/GameFinishEvent.yaml +++ b/doc/specs/schemas/GameFinishEvent.yaml @@ -5,3 +5,5 @@ properties: const: gameFinish game: $ref: './GameEventInfo.yaml' +example: + $ref: '../examples/gameFinish.json' diff --git a/doc/specs/schemas/GameFullEvent.yaml b/doc/specs/schemas/GameFullEvent.yaml index fffbf1e..00c20b5 100644 --- a/doc/specs/schemas/GameFullEvent.yaml +++ b/doc/specs/schemas/GameFullEvent.yaml @@ -48,3 +48,5 @@ required: - black - initialFen - state +example: + $ref: '../examples/gameFull.json' diff --git a/doc/specs/schemas/GameStartEvent.yaml b/doc/specs/schemas/GameStartEvent.yaml index ba3a5b0..53bf4d0 100644 --- a/doc/specs/schemas/GameStartEvent.yaml +++ b/doc/specs/schemas/GameStartEvent.yaml @@ -5,3 +5,5 @@ properties: const: gameStart game: $ref: './GameEventInfo.yaml' +example: + $ref: '../examples/gameStart.json' diff --git a/doc/specs/schemas/GameStateEvent.yaml b/doc/specs/schemas/GameStateEvent.yaml index 0de3d50..6693954 100644 --- a/doc/specs/schemas/GameStateEvent.yaml +++ b/doc/specs/schemas/GameStateEvent.yaml @@ -43,3 +43,5 @@ required: - winc - binc - status +example: + $ref: '../examples/gameState.json' diff --git a/doc/specs/schemas/OpponentGone.yaml b/doc/specs/schemas/OpponentGone.yaml index a1686ab..4b62a23 100644 --- a/doc/specs/schemas/OpponentGone.yaml +++ b/doc/specs/schemas/OpponentGone.yaml @@ -10,3 +10,5 @@ properties: required: - type - gone +example: + $ref: '../examples/opponentGone.json' diff --git a/doc/specs/tags/board/api-board-game-stream-gameId.yaml b/doc/specs/tags/board/api-board-game-stream-gameId.yaml index f286e9d..642ee09 100644 --- a/doc/specs/tags/board/api-board-game-stream-gameId.yaml +++ b/doc/specs/tags/board/api-board-game-stream-gameId.yaml @@ -38,21 +38,6 @@ get: - $ref: '../../schemas/GameStateEvent.yaml' - $ref: '../../schemas/ChatLineEvent.yaml' - $ref: '../../schemas/OpponentGone.yaml' - examples: - gameFull: - $ref: '../../examples/gameFull.yaml' - gameState: - $ref: '../../examples/gameState.yaml' - chatLine: - $ref: '../../examples/chatLine.yaml' - chatLineSpectator: - $ref: '../../examples/chatLineSpectator.yaml' - opponentGoneTrue: - $ref: '../../examples/opponentGoneTrue.yaml' - opponentGoneFalse: - $ref: '../../examples/opponentGoneFalse.yaml' - gameStateResign: - $ref: '../../examples/gameStateResign.yaml' "404": description: The game was not found. content: diff --git a/doc/specs/tags/board/api-stream-event.yaml b/doc/specs/tags/board/api-stream-event.yaml index 74ee602..317a0e6 100644 --- a/doc/specs/tags/board/api-stream-event.yaml +++ b/doc/specs/tags/board/api-stream-event.yaml @@ -34,14 +34,3 @@ get: - $ref: '../../schemas/ChallengeEvent.yaml' - $ref: '../../schemas/ChallengeCanceledEvent.yaml' - $ref: '../../schemas/ChallengeDeclinedEvent.yaml' - examples: - challenge: - $ref: '../../examples/challenge.yaml' - challengeCanceled: - $ref: '../../examples/challengeCanceled.yaml' - challengeDeclined: - $ref: '../../examples/challengeDeclined.yaml' - gameStart: - $ref: '../../examples/gameStart.yaml' - gameFinish: - $ref: '../../examples/gameFinish.yaml' diff --git a/doc/specs/tags/bot/api-bot-game-stream-gameId.yaml b/doc/specs/tags/bot/api-bot-game-stream-gameId.yaml index f1adcc0..7c76f94 100644 --- a/doc/specs/tags/bot/api-bot-game-stream-gameId.yaml +++ b/doc/specs/tags/bot/api-bot-game-stream-gameId.yaml @@ -37,21 +37,6 @@ get: - $ref: '../../schemas/GameStateEvent.yaml' - $ref: '../../schemas/ChatLineEvent.yaml' - $ref: '../../schemas/OpponentGone.yaml' - examples: - gameFull: - $ref: '../../examples/gameFull.yaml' - gameState: - $ref: '../../examples/gameState.yaml' - chatLine: - $ref: '../../examples/chatLine.yaml' - chatLineSpectator: - $ref: '../../examples/chatLineSpectator.yaml' - opponentGoneTrue: - $ref: '../../examples/opponentGoneTrue.yaml' - opponentGoneFalse: - $ref: '../../examples/opponentGoneFalse.yaml' - gameStateResign: - $ref: '../../examples/gameStateResign.yaml' "404": description: The bot game was not found. content: From 24a8eaa9846d17552ff37606c9b5477abf6423bc Mon Sep 17 00:00:00 2001 From: tors42 <4084220+tors42@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:58:45 +0200 Subject: [PATCH 3/4] Disable 'no-ambiguous-paths' Redocly-warning --- doc/redocly.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/redocly.yaml b/doc/redocly.yaml index fb9504e..5d273f5 100644 --- a/doc/redocly.yaml +++ b/doc/redocly.yaml @@ -7,3 +7,9 @@ extends: rules: operation-4xx-response: off + no-ambiguous-paths: off # 25 warnings, 2024-04-09 + # Example ambiguous paths: + # /api/tournament/{id1}/join + # /api/tournament/team-battle/{id2} + # If id1 has value "team-battle", and id2 has value "join", + # these paths would be identical... From fc2d9ab2ccff408b4c1abd0de28eae4ececfe31f Mon Sep 17 00:00:00 2001 From: tors42 <4084220+tors42@users.noreply.github.com> Date: Tue, 9 Apr 2024 22:23:13 +0200 Subject: [PATCH 4/4] Fix trailing , --- doc/specs/examples/gameFull.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/specs/examples/gameFull.json b/doc/specs/examples/gameFull.json index 3ed2fd4..74b4109 100644 --- a/doc/specs/examples/gameFull.json +++ b/doc/specs/examples/gameFull.json @@ -26,7 +26,7 @@ "black": { "id": "leela", "name": "leela", - "rating": 2390, + "rating": 2390 }, "initialFen": "startpos", "state": {