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

Add meta and source fields to JSONAPIErrorItem #2332

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-06 18:09:27.833401",
"spec_repo_commit": "c020103f"
"regenerated": "2025-01-06 19:03:08.173026",
"spec_repo_commit": "b56ea2d7"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-06 18:09:27.848470",
"spec_repo_commit": "c020103f"
"regenerated": "2025-01-06 19:03:08.194805",
"spec_repo_commit": "b56ea2d7"
}
}
}
24 changes: 24 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
@@ -15109,6 +15109,12 @@ components:
the error.
example: Missing required attribute in body
type: string
meta:
additionalProperties: {}
description: Non-standard meta-information about the error
type: object
source:
$ref: '#/components/schemas/JSONAPIErrorItemSource'
status:
description: Status code of the response.
example: '400'
@@ -15118,6 +15124,24 @@ components:
example: Bad Request
type: string
type: object
JSONAPIErrorItemSource:
description: References to the source of the error.
properties:
header:
description: A string indicating the name of a single request header which
caused the error.
example: Authorization
type: string
parameter:
description: A string indicating which URI query parameter caused the error.
example: limit
type: string
pointer:
description: A JSON pointer to the value in the request document that caused
the error.
example: /data/attributes/title
type: string
type: object
JSONAPIErrorResponse:
description: API error response.
properties:
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
@@ -6353,6 +6353,13 @@ datadog\_api\_client.v2.model.jsonapi\_error\_item module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.jsonapi\_error\_item\_source module
-----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.jsonapi_error_item_source
:members:
:show-inheritance:

datadog\_api\_client.v2.model.jsonapi\_error\_response module
-------------------------------------------------------------

43 changes: 42 additions & 1 deletion src/datadog_api_client/v2/model/jsonapi_error_item.py
Original file line number Diff line number Diff line change
@@ -3,34 +3,65 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union
from typing import Any, Dict, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
date,
datetime,
none_type,
unset,
UnsetType,
UUID,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.jsonapi_error_item_source import JSONAPIErrorItemSource


class JSONAPIErrorItem(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.jsonapi_error_item_source import JSONAPIErrorItemSource

return {
"detail": (str,),
"meta": (
{
str: (
bool,
date,
datetime,
dict,
float,
int,
list,
str,
UUID,
none_type,
)
},
),
"source": (JSONAPIErrorItemSource,),
"status": (str,),
"title": (str,),
}

attribute_map = {
"detail": "detail",
"meta": "meta",
"source": "source",
"status": "status",
"title": "title",
}

def __init__(
self_,
detail: Union[str, UnsetType] = unset,
meta: Union[Dict[str, Any], UnsetType] = unset,
source: Union[JSONAPIErrorItemSource, UnsetType] = unset,
status: Union[str, UnsetType] = unset,
title: Union[str, UnsetType] = unset,
**kwargs,
@@ -41,6 +72,12 @@ def __init__(
:param detail: A human-readable explanation specific to this occurrence of the error.
:type detail: str, optional

:param meta: Non-standard meta-information about the error
:type meta: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional

:param source: References to the source of the error.
:type source: JSONAPIErrorItemSource, optional

:param status: Status code of the response.
:type status: str, optional

@@ -49,6 +86,10 @@ def __init__(
"""
if detail is not unset:
kwargs["detail"] = detail
if meta is not unset:
kwargs["meta"] = meta
if source is not unset:
kwargs["source"] = source
if status is not unset:
kwargs["status"] = status
if title is not unset:
56 changes: 56 additions & 0 deletions src/datadog_api_client/v2/model/jsonapi_error_item_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


class JSONAPIErrorItemSource(ModelNormal):
@cached_property
def openapi_types(_):
return {
"header": (str,),
"parameter": (str,),
"pointer": (str,),
}

attribute_map = {
"header": "header",
"parameter": "parameter",
"pointer": "pointer",
}

def __init__(
self_,

Choose a reason for hiding this comment

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

🔴 Code Quality Violation

Suggested change
self_,
self,
first parameter of a class function should be self (...read more)

In a class method (that is not a class method nor a static method), the first argument must be self by convention.

Learn More

View in Datadog  Leave us feedback  Documentation

header: Union[str, UnsetType] = unset,
parameter: Union[str, UnsetType] = unset,
pointer: Union[str, UnsetType] = unset,
**kwargs,
):
"""
References to the source of the error.

:param header: A string indicating the name of a single request header which caused the error.
:type header: str, optional

:param parameter: A string indicating which URI query parameter caused the error.
:type parameter: str, optional

:param pointer: A JSON pointer to the value in the request document that caused the error.
:type pointer: str, optional
"""
if header is not unset:
kwargs["header"] = header
if parameter is not unset:
kwargs["parameter"] = parameter
if pointer is not unset:
kwargs["pointer"] = pointer
super().__init__(kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1105,6 +1105,7 @@
from datadog_api_client.v2.model.interface_attributes import InterfaceAttributes
from datadog_api_client.v2.model.interface_attributes_status import InterfaceAttributesStatus
from datadog_api_client.v2.model.jsonapi_error_item import JSONAPIErrorItem
from datadog_api_client.v2.model.jsonapi_error_item_source import JSONAPIErrorItemSource
from datadog_api_client.v2.model.jsonapi_error_response import JSONAPIErrorResponse
from datadog_api_client.v2.model.jira_integration_metadata import JiraIntegrationMetadata
from datadog_api_client.v2.model.jira_integration_metadata_issues_item import JiraIntegrationMetadataIssuesItem
@@ -3224,6 +3225,7 @@
"InterfaceAttributes",
"InterfaceAttributesStatus",
"JSONAPIErrorItem",
"JSONAPIErrorItemSource",
"JSONAPIErrorResponse",
"JiraIntegrationMetadata",
"JiraIntegrationMetadataIssuesItem",