Skip to content

[DEX-114] add custom extent prop for geomap widget #694

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
Open
Show file tree
Hide file tree
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
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-06 14:53:21.094407",
"spec_repo_commit": "e591d5d4"
"regenerated": "2025-06-06 17:05:57.005896",
"spec_repo_commit": "b8f8eb97"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-06 14:53:21.112774",
"spec_repo_commit": "e591d5d4"
"regenerated": "2025-06-06 17:05:57.022353",
"spec_repo_commit": "b8f8eb97"
}
}
}
16 changes: 16 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3439,6 +3439,22 @@ components:
example:
focus: WORLD
properties:
custom_extent:
description: A custom extent of the map defined by an array of four numbers
in the order `[minLongitude, minLatitude, maxLongitude, maxLatitude]`.
example:
- -30
- -40
- 40
- 30
items:
description: The longitudinal or latitudinal coordinates of the bounding
box.
format: double
type: number
maxItems: 4
minItems: 4
type: array
focus:
description: The 2-letter ISO code of a country to focus the map on. Or
`WORLD`.
Expand Down
18 changes: 18 additions & 0 deletions src/datadogV1/model/model_geomap_widget_definition_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct GeomapWidgetDefinitionView {
/// A custom extent of the map defined by an array of four numbers in the order `[minLongitude, minLatitude, maxLongitude, maxLatitude]`.
#[serde(rename = "custom_extent")]
pub custom_extent: Option<Vec<f64>>,
/// The 2-letter ISO code of a country to focus the map on. Or `WORLD`.
#[serde(rename = "focus")]
pub focus: String,
Expand All @@ -24,12 +27,18 @@ pub struct GeomapWidgetDefinitionView {
impl GeomapWidgetDefinitionView {
pub fn new(focus: String) -> GeomapWidgetDefinitionView {
GeomapWidgetDefinitionView {
custom_extent: None,
focus,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn custom_extent(mut self, value: Vec<f64>) -> Self {
self.custom_extent = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand All @@ -56,6 +65,7 @@ impl<'de> Deserialize<'de> for GeomapWidgetDefinitionView {
where
M: MapAccess<'a>,
{
let mut custom_extent: Option<Vec<f64>> = None;
let mut focus: Option<String> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
Expand All @@ -65,6 +75,13 @@ impl<'de> Deserialize<'de> for GeomapWidgetDefinitionView {

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"custom_extent" => {
if v.is_null() {
continue;
}
custom_extent =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"focus" => {
focus = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
Expand All @@ -78,6 +95,7 @@ impl<'de> Deserialize<'de> for GeomapWidgetDefinitionView {
let focus = focus.ok_or_else(|| M::Error::missing_field("focus"))?;

let content = GeomapWidgetDefinitionView {
custom_extent,
focus,
additional_properties,
_unparsed,
Expand Down
Loading