Skip to content

Commit 2ba6d5d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Correct Error Response of Metric Tag Cardinalities Endpoint (#2631)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent b229327 commit 2ba6d5d

File tree

8 files changed

+209
-11
lines changed

8 files changed

+209
-11
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "d02c8a3",
3-
"generated": "2025-08-08 12:07:03.564"
2+
"spec_repo_commit": "3a6cb30",
3+
"generated": "2025-08-12 15:41:07.024"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55875,25 +55875,25 @@ paths:
5587555875
content:
5587655876
application/json:
5587755877
schema:
55878-
$ref: '#/components/schemas/APIErrorResponse'
55878+
$ref: '#/components/schemas/JSONAPIErrorResponse'
5587955879
description: Bad Request
5588055880
'403':
5588155881
content:
5588255882
application/json:
5588355883
schema:
55884-
$ref: '#/components/schemas/APIErrorResponse'
55884+
$ref: '#/components/schemas/JSONAPIErrorResponse'
5588555885
description: Forbidden
5588655886
'404':
5588755887
content:
5588855888
application/json:
5588955889
schema:
55890-
$ref: '#/components/schemas/APIErrorResponse'
55890+
$ref: '#/components/schemas/JSONAPIErrorResponse'
5589155891
description: Not Found
5589255892
'429':
5589355893
content:
5589455894
application/json:
5589555895
schema:
55896-
$ref: '#/components/schemas/APIErrorResponse'
55896+
$ref: '#/components/schemas/JSONAPIErrorResponse'
5589755897
description: Too Many Requests
5589855898
summary: Get tag key cardinality details
5589955899
tags:

services/metrics/src/v2/MetricsApi.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
import { TypingInfo } from "./models/TypingInfo";
2525
import { APIErrorResponse } from "./models/APIErrorResponse";
2626
import { IntakePayloadAccepted } from "./models/IntakePayloadAccepted";
27+
import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse";
2728
import { MetricAllTagsResponse } from "./models/MetricAllTagsResponse";
2829
import { MetricAssetsResponse } from "./models/MetricAssetsResponse";
2930
import { MetricBulkTagConfigCreateRequest } from "./models/MetricBulkTagConfigCreateRequest";
@@ -1285,21 +1286,24 @@ export class MetricsApiResponseProcessor {
12851286
response.httpStatusCode === 429
12861287
) {
12871288
const bodyText = parse(await response.body.text(), contentType);
1288-
let body: APIErrorResponse;
1289+
let body: JSONAPIErrorResponse;
12891290
try {
12901291
body = deserialize(
12911292
bodyText,
12921293
TypingInfo,
1293-
"APIErrorResponse",
1294-
) as APIErrorResponse;
1294+
"JSONAPIErrorResponse",
1295+
) as JSONAPIErrorResponse;
12951296
} catch (error) {
12961297
logger.debug(`Got error deserializing error: ${error}`);
1297-
throw new ApiException<APIErrorResponse>(
1298+
throw new ApiException<JSONAPIErrorResponse>(
12981299
response.httpStatusCode,
12991300
bodyText,
13001301
);
13011302
}
1302-
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
1303+
throw new ApiException<JSONAPIErrorResponse>(
1304+
response.httpStatusCode,
1305+
body,
1306+
);
13031307
}
13041308

13051309
// Work around for missing responses in specification, e.g. for petstore.yaml

services/metrics/src/v2/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export { EventsTimeseriesQuery } from "./models/EventsTimeseriesQuery";
3232
export { FormulaLimit } from "./models/FormulaLimit";
3333
export { GroupScalarColumn } from "./models/GroupScalarColumn";
3434
export { IntakePayloadAccepted } from "./models/IntakePayloadAccepted";
35+
export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem";
36+
export { JSONAPIErrorItemSource } from "./models/JSONAPIErrorItemSource";
37+
export { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse";
3538
export { Metric } from "./models/Metric";
3639
export { MetricActiveConfigurationType } from "./models/MetricActiveConfigurationType";
3740
export { MetricAllTags } from "./models/MetricAllTags";
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { AttributeTypeMap } from "@datadog/datadog-api-client";
2+
3+
import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource";
4+
5+
/**
6+
* API error response body
7+
*/
8+
export class JSONAPIErrorItem {
9+
/**
10+
* A human-readable explanation specific to this occurrence of the error.
11+
*/
12+
"detail"?: string;
13+
/**
14+
* Non-standard meta-information about the error
15+
*/
16+
"meta"?: { [key: string]: any };
17+
/**
18+
* References to the source of the error.
19+
*/
20+
"source"?: JSONAPIErrorItemSource;
21+
/**
22+
* Status code of the response.
23+
*/
24+
"status"?: string;
25+
/**
26+
* Short human-readable summary of the error.
27+
*/
28+
"title"?: string;
29+
/**
30+
* A container for additional, undeclared properties.
31+
* This is a holder for any undeclared properties as specified with
32+
* the 'additionalProperties' keyword in the OAS document.
33+
*/
34+
"additionalProperties"?: { [key: string]: any };
35+
/**
36+
* @ignore
37+
*/
38+
"_unparsed"?: boolean;
39+
40+
/**
41+
* @ignore
42+
*/
43+
static readonly attributeTypeMap: AttributeTypeMap = {
44+
detail: {
45+
baseName: "detail",
46+
type: "string",
47+
},
48+
meta: {
49+
baseName: "meta",
50+
type: "{ [key: string]: any; }",
51+
},
52+
source: {
53+
baseName: "source",
54+
type: "JSONAPIErrorItemSource",
55+
},
56+
status: {
57+
baseName: "status",
58+
type: "string",
59+
},
60+
title: {
61+
baseName: "title",
62+
type: "string",
63+
},
64+
additionalProperties: {
65+
baseName: "additionalProperties",
66+
type: "{ [key: string]: any; }",
67+
},
68+
};
69+
70+
/**
71+
* @ignore
72+
*/
73+
static getAttributeTypeMap(): AttributeTypeMap {
74+
return JSONAPIErrorItem.attributeTypeMap;
75+
}
76+
77+
public constructor() {}
78+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { AttributeTypeMap } from "@datadog/datadog-api-client";
2+
3+
/**
4+
* References to the source of the error.
5+
*/
6+
export class JSONAPIErrorItemSource {
7+
/**
8+
* A string indicating the name of a single request header which caused the error.
9+
*/
10+
"header"?: string;
11+
/**
12+
* A string indicating which URI query parameter caused the error.
13+
*/
14+
"parameter"?: string;
15+
/**
16+
* A JSON pointer to the value in the request document that caused the error.
17+
*/
18+
"pointer"?: string;
19+
/**
20+
* A container for additional, undeclared properties.
21+
* This is a holder for any undeclared properties as specified with
22+
* the 'additionalProperties' keyword in the OAS document.
23+
*/
24+
"additionalProperties"?: { [key: string]: any };
25+
/**
26+
* @ignore
27+
*/
28+
"_unparsed"?: boolean;
29+
30+
/**
31+
* @ignore
32+
*/
33+
static readonly attributeTypeMap: AttributeTypeMap = {
34+
header: {
35+
baseName: "header",
36+
type: "string",
37+
},
38+
parameter: {
39+
baseName: "parameter",
40+
type: "string",
41+
},
42+
pointer: {
43+
baseName: "pointer",
44+
type: "string",
45+
},
46+
additionalProperties: {
47+
baseName: "additionalProperties",
48+
type: "{ [key: string]: any; }",
49+
},
50+
};
51+
52+
/**
53+
* @ignore
54+
*/
55+
static getAttributeTypeMap(): AttributeTypeMap {
56+
return JSONAPIErrorItemSource.attributeTypeMap;
57+
}
58+
59+
public constructor() {}
60+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { AttributeTypeMap } from "@datadog/datadog-api-client";
2+
3+
import { JSONAPIErrorItem } from "./JSONAPIErrorItem";
4+
5+
/**
6+
* API error response.
7+
*/
8+
export class JSONAPIErrorResponse {
9+
/**
10+
* A list of errors.
11+
*/
12+
"errors": Array<JSONAPIErrorItem>;
13+
/**
14+
* A container for additional, undeclared properties.
15+
* This is a holder for any undeclared properties as specified with
16+
* the 'additionalProperties' keyword in the OAS document.
17+
*/
18+
"additionalProperties"?: { [key: string]: any };
19+
/**
20+
* @ignore
21+
*/
22+
"_unparsed"?: boolean;
23+
24+
/**
25+
* @ignore
26+
*/
27+
static readonly attributeTypeMap: AttributeTypeMap = {
28+
errors: {
29+
baseName: "errors",
30+
type: "Array<JSONAPIErrorItem>",
31+
required: true,
32+
},
33+
additionalProperties: {
34+
baseName: "additionalProperties",
35+
type: "{ [key: string]: any; }",
36+
},
37+
};
38+
39+
/**
40+
* @ignore
41+
*/
42+
static getAttributeTypeMap(): AttributeTypeMap {
43+
return JSONAPIErrorResponse.attributeTypeMap;
44+
}
45+
46+
public constructor() {}
47+
}

services/metrics/src/v2/models/TypingInfo.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { EventsTimeseriesQuery } from "./EventsTimeseriesQuery";
1111
import { FormulaLimit } from "./FormulaLimit";
1212
import { GroupScalarColumn } from "./GroupScalarColumn";
1313
import { IntakePayloadAccepted } from "./IntakePayloadAccepted";
14+
import { JSONAPIErrorItem } from "./JSONAPIErrorItem";
15+
import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource";
16+
import { JSONAPIErrorResponse } from "./JSONAPIErrorResponse";
1417
import { Metric } from "./Metric";
1518
import { MetricAllTags } from "./MetricAllTags";
1619
import { MetricAllTagsAttributes } from "./MetricAllTagsAttributes";
@@ -184,6 +187,9 @@ export const TypingInfo: ModelTypingInfo = {
184187
FormulaLimit: FormulaLimit,
185188
GroupScalarColumn: GroupScalarColumn,
186189
IntakePayloadAccepted: IntakePayloadAccepted,
190+
JSONAPIErrorItem: JSONAPIErrorItem,
191+
JSONAPIErrorItemSource: JSONAPIErrorItemSource,
192+
JSONAPIErrorResponse: JSONAPIErrorResponse,
187193
Metric: Metric,
188194
MetricAllTags: MetricAllTags,
189195
MetricAllTagsAttributes: MetricAllTagsAttributes,

0 commit comments

Comments
 (0)