Skip to main content

nautobot_openapi/models/
object_metadata_request.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/// ObjectMetadataRequest : 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 ObjectMetadataRequest {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "assigned_object_type")]
18    pub assigned_object_type: String,
19    #[serde(
20        rename = "value",
21        default,
22        with = "::serde_with::rust::double_option",
23        skip_serializing_if = "Option::is_none"
24    )]
25    pub value: Option<Option<serde_json::Value>>,
26    /// List of scoped fields, only direct fields on the model
27    #[serde(
28        rename = "scoped_fields",
29        default,
30        with = "::serde_with::rust::double_option",
31        skip_serializing_if = "Option::is_none"
32    )]
33    pub scoped_fields: Option<Option<serde_json::Value>>,
34    #[serde(rename = "assigned_object_id")]
35    pub assigned_object_id: uuid::Uuid,
36    #[serde(rename = "metadata_type")]
37    pub metadata_type: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
38    #[serde(
39        rename = "contact",
40        default,
41        with = "::serde_with::rust::double_option",
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub contact: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
45    #[serde(
46        rename = "team",
47        default,
48        with = "::serde_with::rust::double_option",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub team: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
52}
53
54impl ObjectMetadataRequest {
55    /// 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>)
56    pub fn new(
57        assigned_object_type: String,
58        assigned_object_id: uuid::Uuid,
59        metadata_type: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
60    ) -> ObjectMetadataRequest {
61        ObjectMetadataRequest {
62            id: None,
63            assigned_object_type,
64            value: None,
65            scoped_fields: None,
66            assigned_object_id,
67            metadata_type: Box::new(metadata_type),
68            contact: None,
69            team: None,
70        }
71    }
72}