Skip to main content

feldera_rest_api/
lib.rs

1mod generated {
2    #![allow(clippy::all, unused)]
3    include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
4}
5pub use generated::*;
6
7mod retry;
8pub use retry::RetryPolicy;
9
10// ClientInfo is already in scope through the generated code's public
11// re-export; importing it again here would shadow that re-export.
12use progenitor_client::{ClientHooks, OperationInfo};
13
14/// Route every request through the retry layer. Overrides the no-op default
15/// on `&Client` via auto-ref specialization (see `progenitor_client::ClientHooks`).
16impl ClientHooks<RetryPolicy> for Client {
17    async fn exec(
18        &self,
19        request: reqwest::Request,
20        info: &OperationInfo,
21    ) -> reqwest::Result<reqwest::Response> {
22        retry::execute_with_retry(
23            self.client(),
24            self.inner(),
25            self.baseurl(),
26            request,
27            info.operation_id,
28        )
29        .await
30    }
31}
32
33#[cfg(test)]
34mod tests {
35    use super::types::CheckpointMetadata;
36
37    /// Reproduces issue #6841: `fda pipelines`/`fda status` failed to parse
38    /// any pipeline's checkpoint list once one checkpoint's fingerprint had
39    /// the high bit set, because the generated `fingerprint` field was `i64`.
40    /// `format: uint64` on that field (checkpoint.rs) makes progenitor/typify
41    /// generate `u64` instead, so this must deserialize without error.
42    #[test]
43    fn checkpoint_metadata_accepts_fingerprint_above_i64_max() {
44        let raw = r#"{
45            "uuid": "00000000-0000-0000-0000-000000000000",
46            "fingerprint": 14128757731148314856
47        }"#;
48        let metadata: CheckpointMetadata = serde_json::from_str(raw).unwrap();
49        assert_eq!(metadata.fingerprint, 14128757731148314856);
50    }
51}