Skip to content

Commit 0da5a40

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Reference Tables API spec: disallow additional properties from FileMetadata (#1019)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e4f3241 commit 0da5a40

File tree

3 files changed

+8
-38
lines changed

3 files changed

+8
-38
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50997,6 +50997,7 @@ components:
5099750997
- $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataCloudStorage'
5099850998
- $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataLocalFile'
5099950999
TableResultV2DataAttributesFileMetadataCloudStorage:
51000+
additionalProperties: false
5100051001
description: File metadata for reference tables created by cloud storage.
5100151002
properties:
5100251003
access_details:
@@ -51043,6 +51044,7 @@ components:
5104351044
- OPERATION_ERROR
5104451045
- SYSTEM_ERROR
5104551046
TableResultV2DataAttributesFileMetadataLocalFile:
51047+
additionalProperties: false
5104651048
description: File metadata for reference tables created by upload. Note that
5104751049
upload_id is only returned in the immediate create/replace response and is
5104851050
not available in subsequent GET requests.

src/datadogV2/model/model_table_result_v2_data_attributes_file_metadata_cloud_storage.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ pub struct TableResultV2DataAttributesFileMetadataCloudStorage {
2929
/// Whether this table is synced automatically.
3030
#[serde(rename = "sync_enabled")]
3131
pub sync_enabled: Option<bool>,
32-
#[serde(flatten)]
33-
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
3432
#[serde(skip)]
3533
#[serde(default)]
3634
pub(crate) _unparsed: bool,
@@ -46,7 +44,6 @@ impl TableResultV2DataAttributesFileMetadataCloudStorage {
4644
error_row_count: None,
4745
error_type: None,
4846
sync_enabled: None,
49-
additional_properties: std::collections::BTreeMap::new(),
5047
_unparsed: false,
5148
}
5249
}
@@ -73,14 +70,6 @@ impl TableResultV2DataAttributesFileMetadataCloudStorage {
7370
self.sync_enabled = Some(value);
7471
self
7572
}
76-
77-
pub fn additional_properties(
78-
mut self,
79-
value: std::collections::BTreeMap<String, serde_json::Value>,
80-
) -> Self {
81-
self.additional_properties = value;
82-
self
83-
}
8473
}
8574

8675
impl<'de> Deserialize<'de> for TableResultV2DataAttributesFileMetadataCloudStorage {
@@ -105,10 +94,6 @@ impl<'de> Deserialize<'de> for TableResultV2DataAttributesFileMetadataCloudStora
10594
let mut error_row_count: Option<i64> = None;
10695
let mut error_type: Option<crate::datadogV2::model::TableResultV2DataAttributesFileMetadataCloudStorageErrorType> = None;
10796
let mut sync_enabled: Option<bool> = None;
108-
let mut additional_properties: std::collections::BTreeMap<
109-
String,
110-
serde_json::Value,
111-
> = std::collections::BTreeMap::new();
11297
let mut _unparsed = false;
11398

11499
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
@@ -153,9 +138,9 @@ impl<'de> Deserialize<'de> for TableResultV2DataAttributesFileMetadataCloudStora
153138
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
154139
}
155140
&_ => {
156-
if let Ok(value) = serde_json::from_value(v.clone()) {
157-
additional_properties.insert(k, value);
158-
}
141+
return Err(serde::de::Error::custom(
142+
"Additional properties not allowed",
143+
));
159144
}
160145
}
161146
}
@@ -168,7 +153,6 @@ impl<'de> Deserialize<'de> for TableResultV2DataAttributesFileMetadataCloudStora
168153
error_row_count,
169154
error_type,
170155
sync_enabled,
171-
additional_properties,
172156
_unparsed,
173157
};
174158

src/datadogV2/model/model_table_result_v2_data_attributes_file_metadata_local_file.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ pub struct TableResultV2DataAttributesFileMetadataLocalFile {
1717
/// The number of rows that failed to create/update.
1818
#[serde(rename = "error_row_count")]
1919
pub error_row_count: Option<i64>,
20-
#[serde(flatten)]
21-
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
2220
#[serde(skip)]
2321
#[serde(default)]
2422
pub(crate) _unparsed: bool,
@@ -29,7 +27,6 @@ impl TableResultV2DataAttributesFileMetadataLocalFile {
2927
TableResultV2DataAttributesFileMetadataLocalFile {
3028
error_message: None,
3129
error_row_count: None,
32-
additional_properties: std::collections::BTreeMap::new(),
3330
_unparsed: false,
3431
}
3532
}
@@ -43,14 +40,6 @@ impl TableResultV2DataAttributesFileMetadataLocalFile {
4340
self.error_row_count = Some(value);
4441
self
4542
}
46-
47-
pub fn additional_properties(
48-
mut self,
49-
value: std::collections::BTreeMap<String, serde_json::Value>,
50-
) -> Self {
51-
self.additional_properties = value;
52-
self
53-
}
5443
}
5544

5645
impl Default for TableResultV2DataAttributesFileMetadataLocalFile {
@@ -78,10 +67,6 @@ impl<'de> Deserialize<'de> for TableResultV2DataAttributesFileMetadataLocalFile
7867
{
7968
let mut error_message: Option<String> = None;
8069
let mut error_row_count: Option<i64> = None;
81-
let mut additional_properties: std::collections::BTreeMap<
82-
String,
83-
serde_json::Value,
84-
> = std::collections::BTreeMap::new();
8570
let mut _unparsed = false;
8671

8772
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
@@ -101,17 +86,16 @@ impl<'de> Deserialize<'de> for TableResultV2DataAttributesFileMetadataLocalFile
10186
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
10287
}
10388
&_ => {
104-
if let Ok(value) = serde_json::from_value(v.clone()) {
105-
additional_properties.insert(k, value);
106-
}
89+
return Err(serde::de::Error::custom(
90+
"Additional properties not allowed",
91+
));
10792
}
10893
}
10994
}
11095

11196
let content = TableResultV2DataAttributesFileMetadataLocalFile {
11297
error_message,
11398
error_row_count,
114-
additional_properties,
11599
_unparsed,
116100
};
117101

0 commit comments

Comments
 (0)