Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use oneOf for Broadcast Round form schema mutually exclusive properties #389

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 109 additions & 98 deletions doc/specs/schemas/BroadcastRoundForm.yaml
Original file line number Diff line number Diff line change
@@ -1,103 +1,114 @@
type: object
properties:
name:
type: string
maxLength: 80
minLength: 3
description: |
Name of the broadcast round.
Example: `Round 1`
syncUrl:
type: string
format: uri
description: |
URL that Lichess will poll to get updates about the games. It must be publicly accessible from the Internet.

Example:
```txt
https://myserver.org/myevent/round-10/games.pgn
```

Choose one between `syncUrl`, `syncUrls` and `syncIds`, if it is missing, the broadcast needs to be fed by [pushing PGN to it](#operation/broadcastPush)
syncUrls:
type: string
description: |
URLs that Lichess will poll to get updates about the games, separated by newlines. They must be publicly accessible from the Internet.

Example:
```txt
https://myserver.org/myevent/round-10/game-1.pgn
https://myserver.org/myevent/round-10/game-2.pgn
```

Choose one between `syncUrl`, `syncUrls` and `syncIds`, if it is missing, the broadcast needs to be fed by [pushing PGN to it](#operation/broadcastPush)
syncIds:
type: string
description: |
Lichess game IDs - Up to 64 Lichess game IDs, separated by spaces.
on
Choose one between `syncUrl`, `syncUrls` and `syncIds`, if it is missing, the broadcast needs to be fed by [pushing PGN to it](#operation/broadcastPush)
onlyRound:
type: integer
maximum: 999
minimum: 1
description: |
Filter games by round number
allOf:
- type: object
properties:
name:
type: string
maxLength: 80
minLength: 3
description: |
Name of the broadcast round.
Example: `Round 1`
onlyRound:
type: integer
maximum: 999
minimum: 1
description: |
Filter games by round number

Optional, only keep games from the source that match a round number.
It uses the PGN **Round** tag. These would match round 3:
```txt
[Round "3"]
[Round "3.1"]
```
If you set a round number, then games without a **Round** tag are dropped.
Optional, only keep games from the source that match a round number.
It uses the PGN **Round** tag. These would match round 3:
```txt
[Round "3"]
[Round "3.1"]
```
If you set a round number, then games without a **Round** tag are dropped.

It only works if you chose `syncUrl` or `syncUrls` as the source.
slices:
type: string
description: |
Select slices of the games
It only works if you chose `syncUrl` or `syncUrls` as the source.
slices:
type: string
description: |
Select slices of the games

Optional. Select games based on their position in the source.
```txt
1 only select the first board
1-4 only select the first 4 boards
1,2,3,4 same as above, first 4 boards
11-15,21-25 boards 11 to 15, and boards 21 to 25
2,3,7-9 boards 2, 3, 7, 8, and 9
```
Slicing is done after filtering by round number.
Optional. Select games based on their position in the source.
```txt
1 only select the first board
1-4 only select the first 4 boards
1,2,3,4 same as above, first 4 boards
11-15,21-25 boards 11 to 15, and boards 21 to 25
2,3,7-9 boards 2, 3, 7, 8, and 9
```
Slicing is done after filtering by round number.

It only works if you chose `syncUrl` or `syncUrls` as the source.
startsAt:
type: integer
description: |
Timestamp in milliseconds of broadcast round start. Leave empty to manually start the broadcast round.
Example: `1356998400070`
minimum: 1356998400070
startsAfterPrevious:
type: boolean
description: |
The start date is unknown, and the round will start automatically when the previous round completes.
default: false
delay:
type: integer
description: |
Delay in seconds for movements to appear on the broadcast. Leave it empty if you don't need it.
Example: `900` (15 min)
minimum: 0
maximum: 3600
finished:
type: boolean
description: |
Mark whether the round has been completed.
default: false
period:
type: integer
description: |
(Only for Admins) Waiting time for each poll.
minimum: 2
maximum: 60
It only works if you chose `syncUrl` or `syncUrls` as the source.
startsAt:
type: integer
description: |
Timestamp in milliseconds of broadcast round start. Leave empty to manually start the broadcast round.
Example: `1356998400070`
minimum: 1356998400070
startsAfterPrevious:
type: boolean
description: |
The start date is unknown, and the round will start automatically when the previous round completes.
default: false
delay:
type: integer
description: |
Delay in seconds for movements to appear on the broadcast. Leave it empty if you don't need it.
Example: `900` (15 min)
minimum: 0
maximum: 3600
finished:
type: boolean
description: |
Mark whether the round has been completed.
default: false
period:
type: integer
description: |
(Only for Admins) Waiting time for each poll.
minimum: 2
maximum: 60

required:
- name
required:
- name

- oneOf:
- type: object
title: send games via push
- type: object
title: syncUrl
properties:
syncUrl:
type: string
format: uri
description: |
URL that Lichess will poll to get updates about the games. It must be publicly accessible from the Internet.

Example:
```txt
https://myserver.org/myevent/round-10/games.pgn
```
Choose one between `syncUrl`, `syncUrls` and `syncIds`, if it is missing, the broadcast needs to be fed by [pushing PGN to it](#operation/broadcastPush)
- type: object
title: syncUrls
properties:
syncUrls:
type: string
description: |
URLs that Lichess will poll to get updates about the games, separated by newlines. They must be publicly accessible from the Internet.

Example:
```txt
https://myserver.org/myevent/round-10/game-1.pgn
https://myserver.org/myevent/round-10/game-2.pgn
```
Choose one between `syncUrl`, `syncUrls` and `syncIds`, if it is missing, the broadcast needs to be fed by [pushing PGN to it](#operation/broadcastPush)
- type: object
title: syncIds
properties:
syncIds:
type: string
description: |
Lichess game IDs - Up to 64 Lichess game IDs, separated by spaces.
Choose one between `syncUrl`, `syncUrls` and `syncIds`, if it is missing, the broadcast needs to be fed by [pushing PGN to it](#operation/broadcastPush)