Skip to main content

nautobot_openapi/models/
bulk_writable_metadata_choice_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/// BulkWritableMetadataChoiceRequest : 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 BulkWritableMetadataChoiceRequest {
15    #[serde(rename = "id")]
16    pub id: uuid::Uuid,
17    #[serde(rename = "value")]
18    pub value: String,
19    /// Higher weights appear later in the list
20    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
21    pub weight: Option<i32>,
22    #[serde(rename = "metadata_type")]
23    pub metadata_type: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
24}
25
26impl BulkWritableMetadataChoiceRequest {
27    /// 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>)
28    pub fn new(
29        id: uuid::Uuid,
30        value: String,
31        metadata_type: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
32    ) -> BulkWritableMetadataChoiceRequest {
33        BulkWritableMetadataChoiceRequest {
34            id,
35            value,
36            weight: None,
37            metadata_type: Box::new(metadata_type),
38        }
39    }
40}