RiotGames / developer-relations

Riot Games Developer Ecosystem Bug Reporting
http://developer.riotgames.com
746 stars 44 forks source link

[BUG] MATCH-V5 API response object contains memeber name that begins with a digit, and is also not listed in the spec #684

Open Retoon opened 2 years ago

Retoon commented 2 years ago

Bug Description
A member inside the ParticipantDto type called "challenges" contains a digit in the first positition of the key/name:

12AssistStreakCount (Json structure: MatchDto.info.participants[index].challenges.12AssistStreakCount

There is also no mention of this object member in the spec here.

Problem Description
This makes serializing a response body rather awkward as most languages don't allow digits for struct members or object keys. For example, making an interface for serializing a json response string in typescript won't work because typescript doesn't allow variables or object members/keys to start with a digit.

Expected Result
I expected the member to be present in the spec, and to follow widespread convention of most programming languages

Actual Result
A member is present in the response that i wasn't expecting, and in this case a typescript interface cannot be defined due to the aforementioned first-place digit member.

Developer Impact
This makes working or writing a library for the api rather difficult as serialization is relatively awkward

Preconditions
None

Repro Steps

  1. Make an api request to the endpoint here.
  2. Inspect the response object and cross reference it with the specification above

Temporary workaround When defining an interface for the response object (in my case, typescript), you can define string literal keys, like so:

export interface Challenges {
    "12AssistStreakCount": number;
    ...
}

// Access like so:
x.["12AssistStreakCount"]

Issue Comments
The priority for this bug is rather low, but having an up to date spec for the API reference would be a good addition. I have a feeling this one might have flown under the radar because there is a lot of other members in the full response object that start with some numeric notation, but written out fully. (such as threeWardsOneSweeperCount, etc)

Edit: grammar/spelling

MingweiSamuel commented 6 months ago

Is now listed in the spec. Nothing technically wrong with having an key starting with an integer