ppy / osu-web

the browser-facing portion of osu!
https://osu.ppy.sh
GNU Affero General Public License v3.0
982 stars 385 forks source link

`/v2/beatmapsets/{beatmapset}`'s `ratings` property always has a `0` prepended to it #7829

Open frenzibyte opened 3 years ago

frenzibyte commented 3 years ago

Not sure if that's something intentional or not, looks to have been worked around osu!lazer-side by just skipping it. Might be something worth fixing here instead?

peppy commented 3 years ago

Please include the route and the response content you are seeing.

frenzibyte commented 3 years ago

https://osu.ppy.sh/api/v2/beatmapsets/1:

{
    "artist": "Kenji Ninuma",
    "artist_unicode": "Kenji Ninuma",
    ...
    "ratings": [
        0,
        122,
        9,
        25,
        31,
        45,
        69,
        109,
        141,
        119,
        898
    ],

https://osu.ppy.sh/api/v2/beatmapsets/72:

{
    "artist": "Daft Punk",
    "artist_unicode": "Daft Punk",
    ...
    "ratings": [
        0,
        46,
        9,
        9,
        9,
        18,
        39,
        48,
        44,
        47,
        205
    ],
notbakaneko commented 3 years ago

This was likely an attempt to make php return a plain array instead of an associative array - except an associative array would have actually been more suitable considering the rating is actually a key-value. Fixing this, however, would be considered a breaking change to not assume ratings is an array of 0 to 10 values.

peppy commented 3 years ago

Not sure if/when it's worth fixing this. Maybe when we get some kind of API versioning in place..?

notbakaneko commented 3 years ago

this really isn't worth fixing without a breaking change - if there's going to be a breaking change it might as well be fixed to return in a { rating: count } format.