/*
* Orvanta API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 6.5.0
* Contact: contact@orvanta.cloud
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// ColumnMapping : One `source_column -> target_column` pair, optionally carrying a `transform` expression that produces the value actually written.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ColumnMapping {
/// Where the value comes from in the source record. A plain identifier (`user_id`) for a relational source, or a dotted path (`profile.address.city`) reaching inside a structured value for a document source. A single-segment path is exactly the bare column name this field has always carried, so pre-existing mappings are unchanged. Every segment must be a valid identifier; JSON Pointer syntax and array indices are rejected. A connector that only reads top-level fields (Postgres) refuses a dotted path as a dry-run precondition failure rather than at run time -- see `Capabilities.nested_source_paths`.
#[serde(rename = "source_column")]
pub source_column: String,
#[serde(rename = "target_column")]
pub target_column: String,
/// Optional restricted-CEL expression producing the value written to `target_column`. Omit it for a verbatim copy, which is what every mapping did before this field existed. Inside the expression `value` is this entry's own source value and `row.<column>` reads another column of the same row -- `row` may only be indexed by a literal column name, so the set of columns an expression reads is known before the run starts, fetched, and checked against the source schema. Deliberately restricted: an explicit allow-list of operators and functions (`size`, `int`, `double`, `string`, `bool`, `has`, `startsWith`, `endsWith`, `contains`, `lowerAscii`, `upperAscii`, `trim`, `replace`, `split`, `join`, `substring`), no I/O, no clock, no regular expressions, no iteration macros, no implicit type coercion, and both an evaluation-step and an output-size budget. Anything outside the allow-list is rejected at validation time and appears as a `MappingIssue` in the dry-run report, before any write.
#[serde(rename = "transform", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub transform: Option<Option<String>>,
}
impl ColumnMapping {
/// One `source_column -> target_column` pair, optionally carrying a `transform` expression that produces the value actually written.
pub fn new(source_column: String, target_column: String) -> ColumnMapping {
ColumnMapping {
source_column,
target_column,
transform: None,
}
}
}