Skip to content

Bump maximum integration_type value to 15 #2675

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

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

Conversation

colinodell
Copy link

@colinodell colinodell commented Jul 2, 2025

What does this PR do?

Fixes API client exceptions when the list of incident integrations includes integration_type 15.

Current Behavior

We're getting the following exception when making calls to https://api.datadoghq.com/api/v2/incidents/{uuid}/relationships/integrations via this library:

Invalid value for integration_type, must be a value less than or equal to 9

Stack Trace
Traceback (most recent call last):

  File "/venv/lib/python3.11/site-packages/datadog_api_client/v2/api/incidents_api.py", line 986, in list_incident_integrations
    return self._list_incident_integrations_endpoint.call_with_http_info(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/api_client.py", line 785, in call_with_http_info
    return self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/api_client.py", line 290, in call_api
    return self._call_api(
           ^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/api_client.py", line 129, in _call_api
    return_data = self.deserialize(response_data, response_type, check_type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/api_client.py", line 183, in deserialize
    deserialized_data = validate_and_convert_types(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1301, in validate_and_convert_types
    return attempt_convert_item(
           ^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1208, in attempt_convert_item
    raise conversion_exc

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1200, in attempt_convert_item
    return deserialize_model(
           ^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1119, in deserialize_model
    return model_class(**kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/v2/model/incident_integration_metadata_list_response.py", line 79, in __init__
    self_.data = data
    ^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 183, in __setattr__
    self[attr] = value
    ~~~~^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 360, in __setitem__
    self.set_attribute(name, value)

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 155, in set_attribute
    value = validate_and_convert_types(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1345, in validate_and_convert_types
    validate_and_convert_types(

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1301, in validate_and_convert_types
    return attempt_convert_item(
           ^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1208, in attempt_convert_item
    raise conversion_exc

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1200, in attempt_convert_item
    return deserialize_model(
           ^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1119, in deserialize_model
    return model_class(**kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/v2/model/incident_integration_metadata_response_data.py", line 74, in __init__
    super().__init__(kwargs)

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 409, in __init__
    setattr(self, var_name, var_value)

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 183, in __setattr__
    self[attr] = value
    ~~~~^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 360, in __setitem__
    self.set_attribute(name, value)

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 155, in set_attribute
    value = validate_and_convert_types(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1301, in validate_and_convert_types
    return attempt_convert_item(
           ^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1208, in attempt_convert_item
    raise conversion_exc

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1200, in attempt_convert_item
    return deserialize_model(
           ^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 1119, in deserialize_model
    return model_class(**kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/v2/model/incident_integration_metadata_attributes.py", line 111, in __init__
    self_.integration_type = integration_type
    ^^^^^^^^^^^^^^^^^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 183, in __setattr__
    self[attr] = value
    ~~~~^^^^^^

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 360, in __setitem__
    self.set_attribute(name, value)

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 168, in set_attribute
    check_validations(self.validations[name], name, value, self._configuration)

  File "/venv/lib/python3.11/site-packages/datadog_api_client/model_utils.py", line 823, in check_validations
    raise ApiValueError(

datadog_api_client.exceptions.ApiValueError: Invalid value for `integration_type`, must be a value less than or equal to `9`

We captured the API response and saw a value of 15 coming through (which I think is related to On-Call?)

Partial Response (heavily sanitized)
{
  "data": [
    {
      "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "type": "incident_integrations",
      "attributes": {
        // ...
        "integration_type": 1,
        // ...
      },
      // ...
    },
    {
      "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
      "type": "incident_integrations",
      "attributes": {
        // ...
        "integration_type": 8,
        // ...
      },
      // ...
    },
    {
      "id": "zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz",
      "type": "incident_integrations",
      "attributes": {
        // ...
        "integration_type": 4,
        // ...
      },
      // ...
    },
    {
      "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "type": "incident_integrations",
      "attributes": {
        "created": "2025-07-02T11:50:50.283211Z",
        "created_by_uuid": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
        "incident_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "integration_type": 15, // <---------------------------------------- the problematic value
        "last_modified_by_uuid": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
        "metadata": {
          "pages": [
            {
              "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
              "key": "5678",
              "team_id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
              "page_target": {
                "type": "team_uuid",
                "identifier": "cccccccc-cccc-cccc-cccc-cccccccccccc"
              }
            }
          ]
        },
        "modified": "2025-07-02T11:50:50.283211Z",
        "status": 2
      },
      "relationships": {
        "created_by_user": {
          "data": {
            "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
            "type": "users"
          }
        },
        "last_modified_by_user": {
          "data": {
            "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
            "type": "users"
          }
        }
      }
    }
  ],
  "meta": {
    "pagination": {
      "offset": 0,
      "next_offset": 25,
      "size": 4
    }
  }
}

Expected Behavior

The API client should pass along this information to my application instead of raising an exception.

Additional Notes

Instead of bumping this value each time a new integration is added, perhaps the validation should be removed? Otherwise more changes like this will be needed in the future.

Also, my stack trace is from version 2.32.0, but the validation rule seems to exist in the latest version, so I'm assuming the issue is still present in the latest version.

Review checklist

Please check relevant items below:

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

    • Note: CI shouldn't be run on this Draft PR, as its expected to fail without the corresponding schema changes.

@colinodell colinodell marked this pull request as ready for review July 2, 2025 13:51
@colinodell colinodell requested review from a team as code owners July 2, 2025 13:51
Comment on lines 26 to 28
"integration_type": {
"inclusive_maximum": 9,
"inclusive_maximum": 15,
},
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of bumping this value each time a new integration is added, perhaps the validation should be removed altogether? Otherwise, more changes like this will be needed in the future.

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