nautobot_openapi/models/bulk_writable_computed_field_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/// BulkWritableComputedFieldRequest : 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 BulkWritableComputedFieldRequest {
15 #[serde(rename = "id")]
16 pub id: uuid::Uuid,
17 #[serde(rename = "content_type")]
18 pub content_type: String,
19 /// Internal field name. Please use underscores rather than dashes in this key.
20 #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
21 pub key: Option<String>,
22 /// Human-readable grouping that this computed field belongs to.
23 #[serde(rename = "grouping", skip_serializing_if = "Option::is_none")]
24 pub grouping: Option<String>,
25 /// Name of the field as displayed to users
26 #[serde(rename = "label")]
27 pub label: String,
28 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
29 pub description: Option<String>,
30 /// Jinja2 template code for field value
31 #[serde(rename = "template")]
32 pub template: String,
33 /// Fallback value (if any) to be output for the field in the case of a template rendering error.
34 #[serde(rename = "fallback_value", skip_serializing_if = "Option::is_none")]
35 pub fallback_value: Option<String>,
36 #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
37 pub weight: Option<i32>,
38 /// Hide this field from the object's primary information tab. It will appear in the \"Advanced\" tab instead.
39 #[serde(rename = "advanced_ui", skip_serializing_if = "Option::is_none")]
40 pub advanced_ui: Option<bool>,
41}
42
43impl BulkWritableComputedFieldRequest {
44 /// 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>)
45 pub fn new(
46 id: uuid::Uuid,
47 content_type: String,
48 label: String,
49 template: String,
50 ) -> BulkWritableComputedFieldRequest {
51 BulkWritableComputedFieldRequest {
52 id,
53 content_type,
54 key: None,
55 grouping: None,
56 label,
57 description: None,
58 template,
59 fallback_value: None,
60 weight: None,
61 advanced_ui: None,
62 }
63 }
64}