Skip to content

Commit b8b3790

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Specify accepted types for UpsertRows values (#3358)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 9cd3fee commit b8b3790

File tree

5 files changed

+326
-21
lines changed

5 files changed

+326
-21
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7075,19 +7075,27 @@ components:
70757075
BatchUpsertRowsRequestDataAttributes:
70767076
description: Attributes containing row data values for row creation or update
70777077
operations.
7078+
example:
7079+
values: {}
70787080
properties:
70797081
values:
70807082
additionalProperties:
7081-
x-required-field: true
7082-
description: Key-value pairs representing row data, where keys are field
7083-
names from the schema.
7084-
example:
7085-
example_key_value: primary_key_value
7086-
name: row_name
7083+
$ref: '#/components/schemas/BatchUpsertRowsRequestDataAttributesValue'
7084+
description: Key-value pairs representing row data, where keys are schema
7085+
field names and values match the corresponding column types.
70877086
type: object
70887087
required:
70897088
- values
70907089
type: object
7090+
BatchUpsertRowsRequestDataAttributesValue:
7091+
description: Types allowed for Reference Table row values.
7092+
oneOf:
7093+
- example: row_name
7094+
type: string
7095+
- example: 25
7096+
format: int32
7097+
maximum: 2147483647
7098+
type: integer
70917099
BillConfig:
70927100
description: Bill config.
70937101
properties:
@@ -79483,6 +79491,18 @@ paths:
7948379491
requestBody:
7948479492
content:
7948579493
application/json:
79494+
examples:
79495+
happy_path:
79496+
summary: Upsert a row with mixed string and int values
79497+
value:
79498+
data:
79499+
- attributes:
79500+
values:
79501+
age: 25
79502+
example_key_value: primary_key_value
79503+
name: row_name
79504+
id: primary_key_value
79505+
type: row
7948679506
schema:
7948779507
$ref: '#/components/schemas/BatchUpsertRowsRequestArray'
7948879508
required: true

examples/v2/reference-tables/UpsertRows.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ public static void main(String[] args) {
2121
Collections.singletonList(
2222
new BatchUpsertRowsRequestData()
2323
.attributes(
24-
new BatchUpsertRowsRequestDataAttributes()
25-
.values(
26-
Map.ofEntries(
27-
Map.entry("example_key_value", "primary_key_value"),
28-
Map.entry("name", "row_name"))))
24+
new BatchUpsertRowsRequestDataAttributes().values(Map.ofEntries()))
2925
.id("primary_key_value")
3026
.type(TableRowResourceDataType.ROW)));
3127

src/main/java/com/datadog/api/client/v2/model/BatchUpsertRowsRequestDataAttributes.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,43 @@
2424
public class BatchUpsertRowsRequestDataAttributes {
2525
@JsonIgnore public boolean unparsed = false;
2626
public static final String JSON_PROPERTY_VALUES = "values";
27-
private Map<String, Object> values = new HashMap<String, Object>();
27+
private Map<String, BatchUpsertRowsRequestDataAttributesValue> values =
28+
new HashMap<String, BatchUpsertRowsRequestDataAttributesValue>();
2829

2930
public BatchUpsertRowsRequestDataAttributes() {}
3031

3132
@JsonCreator
3233
public BatchUpsertRowsRequestDataAttributes(
33-
@JsonProperty(required = true, value = JSON_PROPERTY_VALUES) Map<String, Object> values) {
34+
@JsonProperty(required = true, value = JSON_PROPERTY_VALUES)
35+
Map<String, BatchUpsertRowsRequestDataAttributesValue> values) {
3436
this.values = values;
3537
}
3638

37-
public BatchUpsertRowsRequestDataAttributes values(Map<String, Object> values) {
39+
public BatchUpsertRowsRequestDataAttributes values(
40+
Map<String, BatchUpsertRowsRequestDataAttributesValue> values) {
3841
this.values = values;
3942
return this;
4043
}
4144

42-
public BatchUpsertRowsRequestDataAttributes putValuesItem(String key, Object valuesItem) {
45+
public BatchUpsertRowsRequestDataAttributes putValuesItem(
46+
String key, BatchUpsertRowsRequestDataAttributesValue valuesItem) {
4347
this.values.put(key, valuesItem);
4448
return this;
4549
}
4650

4751
/**
48-
* Key-value pairs representing row data, where keys are field names from the schema.
52+
* Key-value pairs representing row data, where keys are schema field names and values match the
53+
* corresponding column types.
4954
*
5055
* @return values
5156
*/
5257
@JsonProperty(JSON_PROPERTY_VALUES)
5358
@JsonInclude(value = JsonInclude.Include.ALWAYS)
54-
public Map<String, Object> getValues() {
59+
public Map<String, BatchUpsertRowsRequestDataAttributesValue> getValues() {
5560
return values;
5661
}
5762

58-
public void setValues(Map<String, Object> values) {
63+
public void setValues(Map<String, BatchUpsertRowsRequestDataAttributesValue> values) {
5964
this.values = values;
6065
}
6166

0 commit comments

Comments
 (0)