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

Always serialize required nullable fields #16

Merged
merged 2 commits into from
Feb 20, 2024
Merged
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
3 changes: 3 additions & 0 deletions .generator/src/generator/templates/model_simple.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub struct {{ name }} {
{%- endif %}
{%- if schema.deprecated %}
#[deprecated]
{%- endif %}
{%- if required and nullable %}
#[serialize_always]
{%- endif %}
#[serde(rename = "{{ attr }}"{% if not required and nullable%}, default, with = "::serde_with::rust::double_option"{% endif %})]
pub {{propertyName}}: {{dataType}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use serde_with::skip_serializing_none;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SharedDashboardUpdateRequest {
/// Timeframe setting for the shared dashboard.
#[serialize_always]
#[serde(rename = "global_time")]
pub global_time: Option<crate::datadogV1::model::SharedDashboardUpdateRequestGlobalTime>,
/// Whether to allow viewers to select a different global time setting for the shared dashboard.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use serde_with::skip_serializing_none;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct IncidentCreateRelationships {
/// Relationship to user.
#[serialize_always]
#[serde(rename = "commander_user")]
pub commander_user: Option<crate::datadogV2::model::NullableRelationshipToUser>,
}
Expand Down
1 change: 1 addition & 0 deletions src/datadogV2/model/model_logs_archive_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use serde_with::skip_serializing_none;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogsArchiveAttributes {
/// An archive's destination.
#[serialize_always]
#[serde(rename = "destination")]
pub destination: Option<crate::datadogV2::model::LogsArchiveDestination>,
/// To store the tags in the archive, set the value "true".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use serde_with::skip_serializing_none;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NullableRelationshipToUser {
/// Relationship to user object.
#[serialize_always]
#[serde(rename = "data")]
pub data: Option<crate::datadogV2::model::NullableRelationshipToUserData>,
}
Expand Down
Loading