jira-api-v2 1.0.1

Jira Cloud platform REST API
Documentation
/*
 * The Jira Cloud platform REST API
 *
 * Jira Cloud platform REST API documentation
 *
 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
 * Contact: ecosystem@atlassian.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// FieldMetadata : The metadata describing an issue field.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FieldMetadata {
    /// Whether the field is required.
    #[serde(rename = "required")]
    pub required: bool,
    /// The data type of the field.
    #[serde(rename = "schema")]
    pub schema: Box<models::JsonTypeBean>,
    /// The name of the field.
    #[serde(rename = "name")]
    pub name: String,
    /// The key of the field.
    #[serde(rename = "key")]
    pub key: String,
    /// The URL that can be used to automatically complete the field.
    #[serde(rename = "autoCompleteUrl", skip_serializing_if = "Option::is_none")]
    pub auto_complete_url: Option<String>,
    /// Whether the field has a default value.
    #[serde(rename = "hasDefaultValue", skip_serializing_if = "Option::is_none")]
    pub has_default_value: Option<bool>,
    /// The list of operations that can be performed on the field.
    #[serde(rename = "operations")]
    pub operations: Vec<String>,
    /// The list of values allowed in the field.
    #[serde(rename = "allowedValues", skip_serializing_if = "Option::is_none")]
    pub allowed_values: Option<Vec<serde_json::Value>>,
    /// The default value of the field.
    #[serde(rename = "defaultValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub default_value: Option<Option<serde_json::Value>>,
}

impl FieldMetadata {
    /// The metadata describing an issue field.
    pub fn new(required: bool, schema: models::JsonTypeBean, name: String, key: String, operations: Vec<String>) -> FieldMetadata {
        FieldMetadata {
            required,
            schema: Box::new(schema),
            name,
            key,
            auto_complete_url: None,
            has_default_value: None,
            operations,
            allowed_values: None,
            default_value: None,
        }
    }
}