netbox_openapi/models/
custom_field_choice_set.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// CustomFieldChoiceSet : 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 CustomFieldChoiceSet {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<i32>,
17    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
18    pub url: Option<String>,
19    #[serde(rename = "display_url", skip_serializing_if = "Option::is_none")]
20    pub display_url: Option<String>,
21    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
22    pub display: Option<String>,
23    #[serde(rename = "name")]
24    pub name: String,
25    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
26    pub description: Option<String>,
27    #[serde(rename = "base_choices", skip_serializing_if = "Option::is_none")]
28    pub base_choices: Option<Box<crate::models::CustomFieldChoiceSetBaseChoices>>,
29    #[serde(rename = "extra_choices")]
30    pub extra_choices: Vec<Vec<serde_json::Value>>,
31    /// Choices are automatically ordered alphabetically
32    #[serde(
33        rename = "order_alphabetically",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub order_alphabetically: Option<bool>,
37    #[serde(rename = "choices_count", skip_serializing_if = "Option::is_none")]
38    pub choices_count: Option<i32>,
39    #[serde(
40        rename = "created",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub created: Option<Option<String>>,
46    #[serde(
47        rename = "last_updated",
48        default,
49        with = "::serde_with::rust::double_option",
50        skip_serializing_if = "Option::is_none"
51    )]
52    pub last_updated: Option<Option<String>>,
53}
54
55impl CustomFieldChoiceSet {
56    /// 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>)
57    pub fn new(name: String, extra_choices: Vec<Vec<serde_json::Value>>) -> CustomFieldChoiceSet {
58        CustomFieldChoiceSet {
59            id: None,
60            url: None,
61            display_url: None,
62            display: None,
63            name,
64            description: None,
65            base_choices: None,
66            extra_choices,
67            order_alphabetically: None,
68            choices_count: None,
69            created: None,
70            last_updated: None,
71        }
72    }
73}