Update JSON response format for Broadcast PGN push #14731
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is a suggestion of a restructuring of the JSON response of the the broadcast PGN push endpoint,
https://lichess.org/api#tag/Broadcasts/operation/broadcastPush
It changes from JSON array of name:value objects,
to a single keys:values object.
Oh, as I'm writing this Pull Request, I realize that the original format might have the benefit of keeping a desired order of the tags... Well, opening the Pull Request anyways - in case order isn't important... 🤔
Before
{ "games": [ { "tags": [ { "White": "Rasmus Svane" }, { "WhiteElo": "2632" }, { "WhiteTitle": "GM" }, { "WhiteTeam": "Germany" }, { "Black": "Rajat Makkar" }, { "BlackElo": "2453" }, { "BlackTitle": "FM" }, { "BlackTeam": "France" }, { "Result": "1-0" } ], "moves": 2 }, { "tags": [ { "White": "Joseph Girel" }, { "WhiteElo": "2484" }, { "WhiteTitle": "IM" }, { "WhiteTeam": "France" }, { "Black": "Matthias Bluebaum" }, { "BlackElo": "2658" }, { "BlackTitle": "GM" }, { "BlackTeam": "Germany" }, { "Result": "0-1" } ], "moves": 2 } ] }After
{ "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" }, "moves": 2 } ] }