Skip to content

Commit

Permalink
Update sample req/res for broadcast PGN push (#311)
Browse files Browse the repository at this point in the history
Response format updated,
moves -> tags+moves | tags+error
  • Loading branch information
tors42 authored Feb 23, 2024
1 parent ab5c703 commit 741b8ec
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 5 deletions.
6 changes: 6 additions & 0 deletions doc/specs/examples/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ opponentGoneFalse:

gameStateResign:
$ref: './gameStateResign.yaml'

broadcastPgnPushRequest:
$ref: './broadcastPgnPushRequest.yaml'

broadcastPgnPushResponse:
$ref: './broadcastPgnPushResponse.yaml'
24 changes: 24 additions & 0 deletions doc/specs/examples/broadcastPgnPushRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
value: |
[White "Rasmus Svane"]
[Black "Rajat Makkar"]
[BlackElo "2453"]
[BlackTeam "France"]
[BlackTitle "FM"]
[WhiteTeam "Germany"]
[Result "1-0"]
[WhiteElo "2632"]
[WhiteTitle "GM"]
1. d4 d5
[White "Joseph Girel"]
[Black "Matthias Bluebaum"]
[BlackElo "2658"]
[BlackTeam "Germany"]
[BlackTitle "GM"]
[WhiteTeam "France"]
[Result "0-1"]
[WhiteElo "2484"]
[WhiteTitle "IM"]
1. a8
32 changes: 32 additions & 0 deletions doc/specs/examples/broadcastPgnPushResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
value: {
"games": [
{
"tags": {
"White": "Rasmus Svane",
"Black": "Rajat Makkar",
"BlackElo": "2453",
"BlackTeam": "France",
"BlackTitle": "FM",
"WhiteTeam": "Germany",
"Result": "1-0",
"WhiteElo": "2632",
"WhiteTitle": "GM"
},
"moves": 2
},
{
"tags": {
"White": "Joseph Girel",
"Black": "Matthias Bluebaum",
"BlackElo": "2658",
"BlackTeam": "Germany",
"BlackTitle": "GM",
"WhiteTeam": "France",
"Result": "0-1",
"WhiteElo": "2484",
"WhiteTitle": "IM"
},
"error": "No move found: Pawn a8"
}
]
}
18 changes: 18 additions & 0 deletions doc/specs/schemas/BroadcastPgnPush.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
type: object
properties:
games:
type: array
item:
oneOf:
- type: object
properties:
tags:
type: object
moves:
type: integer
- type: object
properties:
tags:
type: object
error:
type: string
3 changes: 3 additions & 0 deletions doc/specs/schemas/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,6 @@ ExternalEngineWork:

Timeline:
$ref: './Timeline.yaml'

BroadcastPgnPush:
$ref: './BroadcastPgnPush.yaml'
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ post:
text/plain:
schema:
type: string
examples:
broadcastPgnPushRequest:
$ref: '../../examples/broadcastPgnPushRequest.yaml'
responses:
"200":
description: The broadcast was successfully updated.
Expand All @@ -33,11 +36,10 @@ post:
content:
application/json:
schema:
properties:
moves:
type: integer
example:
moves: 12
$ref: '../../schemas/BroadcastPgnPush.yaml'
examples:
broadcastPgnPushResponse:
$ref: '../../examples/broadcastPgnPushResponse.yaml'
"400":
description: There was a problem with the pushed PGN.
headers:
Expand Down

0 comments on commit 741b8ec

Please sign in to comment.