1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* API Documentation
*
* Source of truth and network automation platform
*
* The version of the OpenAPI document: 3.1.0 (3.1)
*
* Generated by: https://openapi-generator.tech
*/
/// BulkWritableCustomFieldRequest : 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>)
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct BulkWritableCustomFieldRequest {
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "content_types")]
pub content_types: Vec<String>,
#[serde(rename = "type")]
pub r#type: crate::models::CustomFieldTypeChoices,
#[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
pub filter_logic: Option<crate::models::FilterLogicEnum>,
#[serde(rename = "label")]
pub label: String,
/// Human-readable grouping that this custom field belongs to.
#[serde(rename = "grouping", skip_serializing_if = "Option::is_none")]
pub grouping: Option<String>,
/// Internal field name. Please use underscores rather than dashes in this key.
#[serde(rename = "key", skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
/// A helpful description for this field.
#[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// If true, this field is required when creating new objects or editing an existing object.
#[serde(rename = "required", skip_serializing_if = "Option::is_none")]
pub required: Option<bool>,
/// Default value for the field (must be a JSON value). Encapsulate strings with double quotes (e.g. \"Foo\").
#[serde(
rename = "default",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub default: Option<Option<serde_json::Value>>,
/// Fields with higher weights appear lower in a form.
#[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
pub weight: Option<i32>,
/// Minimum allowed value (for numeric fields) or length (for text fields).
#[serde(
rename = "validation_minimum",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub validation_minimum: Option<Option<i64>>,
/// Maximum allowed value (for numeric fields) or length (for text fields).
#[serde(
rename = "validation_maximum",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub validation_maximum: Option<Option<i64>>,
/// Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. For example, <code>^[A-Z]{3}$</code> will limit values to exactly three uppercase letters. Regular expression on select and multi-select will be applied at <code>Custom Field Choices</code> definition.
#[serde(rename = "validation_regex", skip_serializing_if = "Option::is_none")]
pub validation_regex: Option<String>,
/// Hide this field from the object's primary information tab. It will appear in the \"Advanced\" tab instead.
#[serde(rename = "advanced_ui", skip_serializing_if = "Option::is_none")]
pub advanced_ui: Option<bool>,
/// A JSON-encoded dictionary of filter parameters defining possible objects that can use this custom field.
#[serde(
rename = "scope_filter",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub scope_filter: Option<Option<serde_json::Value>>,
}
impl BulkWritableCustomFieldRequest {
/// 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>)
pub fn new(
id: uuid::Uuid,
content_types: Vec<String>,
r#type: crate::models::CustomFieldTypeChoices,
label: String,
) -> BulkWritableCustomFieldRequest {
BulkWritableCustomFieldRequest {
id,
content_types,
r#type,
filter_logic: None,
label,
grouping: None,
key: None,
description: None,
required: None,
default: None,
weight: None,
validation_minimum: None,
validation_maximum: None,
validation_regex: None,
advanced_ui: None,
scope_filter: None,
}
}
}