Skip to main content

orvanta_api/models/
column_mapping.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 6.3.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ColumnMapping : One `source_column -> target_column` pair, optionally carrying a `transform` expression that produces the value actually written.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ColumnMapping {
17    /// 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`.
18    #[serde(rename = "source_column")]
19    pub source_column: String,
20    #[serde(rename = "target_column")]
21    pub target_column: String,
22    /// 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.
23    #[serde(rename = "transform", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub transform: Option<Option<String>>,
25}
26
27impl ColumnMapping {
28    /// One `source_column -> target_column` pair, optionally carrying a `transform` expression that produces the value actually written.
29    pub fn new(source_column: String, target_column: String) -> ColumnMapping {
30        ColumnMapping {
31            source_column,
32            target_column,
33            transform: None,
34        }
35    }
36}
37