saintdev / speedrun-api

Rust API for speedrun.com
3 stars 2 forks source link

Category rules can be null #7

Closed FoxLisk closed 4 months ago

FoxLisk commented 4 months ago

This is undocumented afaict. SRC docs describe this field as

rules is a freeform text with some basic, undocumented speedrun.com markup

which is already kind of funny. but I found one in the wild with null instead. This is the URL: https://www.speedrun.com/api/v1/categories/wk6ooqok and the data is as follows:

{
    "data": {
        "id": "wk6ooqok",
        "name": "Nine Ball Tournament",
        "weblink": "https://www.speedrun.com/championship_pool_genesis#Nine_Ball_Tournament",
        "type": "per-game",
        "rules": null,
        "players": {
            "type": "exactly",
            "value": 1
        },
        "miscellaneous": false,
        "links": [
            {
                "rel": "self",
                "uri": "https://www.speedrun.com/api/v1/categories/wk6ooqok"
            },
            {
                "rel": "game",
                "uri": "https://www.speedrun.com/api/v1/games/v1poj846"
            },
            {
                "rel": "variables",
                "uri": "https://www.speedrun.com/api/v1/categories/wk6ooqok/variables"
            },
            {
                "rel": "records",
                "uri": "https://www.speedrun.com/api/v1/categories/wk6ooqok/records"
            },
            {
                "rel": "runs",
                "uri": "https://www.speedrun.com/api/v1/runs?category=wk6ooqok"
            },
            {
                "rel": "leaderboard",
                "uri": "https://www.speedrun.com/api/v1/leaderboards/v1poj846/category/wk6ooqok"
            }
        ]
    }
}

I feel bad even bringing this up, I'm sorry the SRC API is such a goddamn mess, but here we are

saintdev commented 4 months ago

No problem! I'm happy that someone else is able to get use out of the crate and give feedback.

This isn't much of a surprise, I ran into a few similar fields with missing data when mapping out the types.