Skip to main content

nautobot_openapi/models/
metadata_choice.rs

1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// MetadataChoice : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct MetadataChoice {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18    pub object_type: Option<String>,
19    /// Human friendly display value
20    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
21    pub display: Option<String>,
22    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
23    pub url: Option<String>,
24    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
25    pub natural_slug: Option<String>,
26    #[serde(rename = "value")]
27    pub value: String,
28    /// Higher weights appear later in the list
29    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
30    pub weight: Option<i32>,
31    #[serde(rename = "metadata_type")]
32    pub metadata_type: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
33    #[serde(
34        rename = "created",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub created: Option<Option<String>>,
40    #[serde(
41        rename = "last_updated",
42        default,
43        with = "::serde_with::rust::double_option",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub last_updated: Option<Option<String>>,
47}
48
49impl MetadataChoice {
50    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
51    pub fn new(
52        value: String,
53        metadata_type: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
54    ) -> MetadataChoice {
55        MetadataChoice {
56            id: None,
57            object_type: None,
58            display: None,
59            url: None,
60            natural_slug: None,
61            value,
62            weight: None,
63            metadata_type: Box::new(metadata_type),
64            created: None,
65            last_updated: None,
66        }
67    }
68}