vantage_api_client/vista/spec.rs
1//! YAML-facing types for the REST-API Vista driver.
2//!
3//! Only the table-level `api` block carries driver-specific fields.
4//! Column and reference extras stay at `NoExtras` — the universal
5//! `VistaSpec` already covers what's needed (column type/flags,
6//! reference target/kind/foreign_key). URL templating lives on each
7//! table's own `api.endpoint` and is shared across all traversals;
8//! the URL builder peels matching eq-conditions into `{placeholder}`
9//! segments and lets the rest fall through to the query string.
10
11use serde::{Deserialize, Serialize};
12use vantage_vista::{NoExtras, VistaSpec};
13
14#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15#[serde(deny_unknown_fields)]
16pub struct ApiTableExtras {
17 #[serde(default, skip_serializing_if = "Option::is_none")]
18 pub api: Option<ApiTableBlock>,
19}
20
21#[derive(Debug, Clone, Default, Serialize, Deserialize)]
22#[serde(deny_unknown_fields)]
23pub struct ApiTableBlock {
24 /// URL path under the data source's base URL. May contain
25 /// `{placeholder}` segments that `RestApi` substitutes from
26 /// eq-conditions at request time; non-matching eq-conditions
27 /// become query params. Defaults to `spec.name` when absent.
28 #[serde(default, skip_serializing_if = "Option::is_none")]
29 pub endpoint: Option<String>,
30}
31
32pub type ApiColumnExtras = NoExtras;
33pub type ApiReferenceExtras = NoExtras;
34
35/// Legacy alias for callers that already imported `NoApiExtras` from
36/// the placeholder version of this module.
37pub type NoApiExtras = NoExtras;
38
39pub type RestApiVistaSpec = VistaSpec<ApiTableExtras, ApiColumnExtras, ApiReferenceExtras>;