zorkian / go-datadog-api

A Go implementation of the Datadog API.
BSD 3-Clause "New" or "Revised" License
183 stars 156 forks source link

Marker label can be bool #220

Open mrwonko opened 5 years ago

mrwonko commented 5 years ago

TileDefMarker.Label is a *string, but for one of my screenboards Datadog returns true, which results in this error:

json: cannot unmarshal bool into Go struct field TileDefMarker.label of type string

Here's an excerpt of the screenboard that caused this:

{
    "board_title": "anonymized",
    "read_only": false,
    "author_info": {
        "author_name": "anonymous"
    },
    "description": "",
    "board_bgtype": "board_graph",
    "created": "2019-02-19T13:47:39.808958+00:00",
    "created_by": {
        "disabled": false,
        "handle": "anonymous",
        "name": "anonymous",
        "is_admin": false,
        "role": null,
        "access_role": "st",
        "verified": true,
        "email": "anonymous",
        "icon": "https://secure.gravatar.com/avatar/42?s=48&d=retro"
    },
    "new_id": "ano-nym-ous",
    "modified": "2019-02-27T15:50:13.939611+00:00",
    "originalHeight": 80,
    "height": 80,
    "width": "100%",
    "isIntegration": false,
    "disableEditing": false,
    "originalWidth": "100%",
    "widgets": [
        {
            "board_id": 585431,
            "globalTimeframe": {
                "isLive": true,
                "start": 1551278820000,
                "end": 1551282420000
            },
            "title_align": "left",
            "title_size": 16,
            "title": true,
            "generated_title": "anonymized",
            "title_text": "anonymized",
            "height": 13,
            "tile_def": {
                "viz": "timeseries",
                "requests": [
                    {
                        "q": "sum:anonymized.as_count()",
                        "aggregator": "avg",
                        "style": {
                            "width": "normal",
                            "palette": "dog_classic",
                            "type": "solid"
                        },
                        "type": "line",
                        "conditional_formats": []
                    }
                ],
                "autoscale": true,
                "markers": [
                    {
                        "type": "info bold",
                        "val": "0",
                        "value": "y = 0",
                        "label": true
                    }
                ]
            },
            "width": 47,
            "time": {},
            "y": 2,
            "x": 48,
            "legend_size": "0",
            "add_timeframe": true,
            "type": "timeseries",
            "legend": false,
            "isShared": false
        }
    ],
    "disableCog": false,
    "id": 42,
    "isShared": false
}