Skip to main content

nautobot_openapi/models/
custom_field_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/// CustomFieldChoiceRequest : 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 CustomFieldChoiceRequest {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<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 = "custom_field")]
23    pub custom_field: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
24}
25
26impl CustomFieldChoiceRequest {
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        value: String,
30        custom_field: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
31    ) -> CustomFieldChoiceRequest {
32        CustomFieldChoiceRequest {
33            id: None,
34            value,
35            weight: None,
36            custom_field: Box::new(custom_field),
37        }
38    }
39}