splewis/get5

[Bug]: interface Get5Match on document is incorrect

FlowingSPDG opened this issue · 3 comments

Documentation

Get5 Version

v0.15.0

The Issue

Get5Match on document allows undefined for multiple values, but it does not allow null or undefined in most case.

interface Get5Match {
    "match_title": string | undefined // 
    "matchid": string | undefined // 
    "clinch_series": boolean | undefined // 
    "num_maps": number | undefined // 
    "scrim": boolean | undefined // 
    "wingman": boolean | undefined // 
    "players_per_team": number | undefined // 
    "coaches_per_team": number | undefined // 
    "coaches_must_ready": boolean | undefined // 
    "min_players_to_ready": number | undefined // 
    "min_spectators_to_ready": number | undefined // 
    "skip_veto": boolean | undefined // 
    "veto_first": "team1" | "team2" | "random" | undefined // 
    "veto_mode": ['team1_ban' | 'team2_ban'
        | 'team1_pick' | 'team2_pick'] | undefined // 
    "side_type": "standard" | "always_knife"
        | "never_knife" | "random" | undefined // 
    "map_sides": ["team1_ct" | "team1_t" | "knife"] | undefined // 
    "spectators": { // 
        "name": string | undefined // 
        "players": Get5PlayerSet | undefined // 
        "fromfile": string | undefined // 
    } | undefined
    "maplist": string[] | Get5MapListFromFile // 
    "favored_percentage_team1": number | undefined // 
    "favored_percentage_text": string | undefined // 
    "team1": Get5MatchTeam // 
    "team2": Get5MatchTeam | undefined // 
    "cvars": { [key: string]: string | number } | undefined // 
}

Match Configuration

{
    "match_title": "TEST MATCH",
    "matchid": "24c1f1fc-ac7d-4e72-8fe4-ef341d44f225",
    "clinch_series": false,
    "num_maps": 1,
    "scrim": false,
    "wingman": false,
    "players_per_team": 5,
    "coaches_per_team": 0,
    "coaches_must_ready": null,
    "min_players_to_ready": 5,
    "min_spectators_to_ready": 0,
    "skip_veto": false,
    "veto_first": "random",
    "veto_mode": null,
    "side_type": "standard",
    "map_sides": [
    ],
    "spectators": null,
    "maplist": [
        "de_inferno",
        "de_mirage",
        "de_nuke",
        "de_overpass",
        "de_vertigo",
        "de_ancient",
        "de_anubis"
    ],
    "favored_percentage_team1": null,
    "favored_percentage_text": "",
    "team1": {
        "id": "78073420-5dea-4404-9d6e-d34974751567",
        "players": {
            "76561198192393190": "FlowingSPDG"
        },
        "coaches": {
        },
        "name": "Test Team2",
        "tag": "TT",
        "flag": "jp",
        "logo": "",
        "series_score": null,
        "matchtext": null,
        "fromfile": null
    },
    "team2": {
        "id": "bc116035-6486-4a1b-94d3-034bb1736e63",
        "players": {
            "76561198072054549": "FlowingSPDG"
        },
        "coaches": {
        },
        "name": "Test Team2",
        "tag": "TT",
        "flag": "jp",
        "logo": "",
        "series_score": null,
        "matchtext": null,
        "fromfile": null
    },
    "cvars": {
    }
}

Debug Info

No response

Does it allow "null" or "undefined(no field)"?

This is correct. null is not the same as undefined in JS, and the documentation is a TypeScript interface file. When you use undefined in JS and create a JSON object, the key is not added to the output. You should omit values you don't want to use. If you use nulls, Get5 will error when you attempt to load the match config.

This is correct. null is not the same as undefined in JS, and the documentation is a TypeScript interface file. When you use undefined in JS and create a JSON object, the key is not added to the output. You should omit values you don't want to use. If you use nulls, Get5 will error when you attempt to load the match config.

Oh I see that I was wrong. Sorry! and thank you, I will omit field on my project.FlowingSPDG/Got5@979f385