Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use json.Number for Screenboard.Width and ConditionalFormat.Value #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

knqyf263
Copy link

@knqyf263 knqyf263 commented Feb 25, 2019

I got the following error.

FATA[0001] json: cannot unmarshal string into Go struct field Screenboard.width of type int

I investigated this error and found that width is occasionally returned as string.

$ curl -G "https://app.datadoghq.com/api/v1/screen/XXXXXX" -d "api_key=$DATADOG_API_KEY" -d "application_key=$DATADOG_APP_KEY" | jq . | grep width
 "width": "100%",

Another dashboard:

$ curl -G "https://app.datadoghq.com/api/v1/screen/XXXXXX" -d "api_key=$DATADOG_API_KEY" -d "application_key=$DATADOG_APP_KEY" | jq . | grep width
  "width": 424,

ConditionalFormat.Value is also the same.

            "conditional_formats": [
              {
                "palette": "white_on_red",
                "comparator": ">",
                "invert": false,
                "value": 10,
                "custom_bg_color": null,
                "custom_fg_color": null
              },
...
            "conditional_formats": [
              {
                "palette": "white_on_red",
                "comparator": "<",
                "value": "3"
              },

This PR includes breaking changes because it was written in the same way as the codes in other places. But please tell me if there is a better way.

@knqyf263 knqyf263 changed the title Fix Width types for when screenboard width is string Fix Width type for when screenboard width is string Feb 25, 2019
@knqyf263 knqyf263 changed the title Fix Width type for when screenboard width is string Fix type for when screenboard Width and ConditionalFormat.Value are string Feb 26, 2019
@knqyf263 knqyf263 changed the title Fix type for when screenboard Width and ConditionalFormat.Value are string Fix types for when screenboard Width and ConditionalFormat.Value are string Feb 26, 2019
@knqyf263 knqyf263 changed the title Fix types for when screenboard Width and ConditionalFormat.Value are string Use json.Number for Screenboard.Width and ConditionalFormat.Value Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant