@@ -4,9 +4,9 @@ use crate::execution::{evaluator, indexing_status, memoization, row_indexer, sta
44use crate :: lib_context:: LibContext ;
55use crate :: { base:: schema:: FlowSchema , ops:: interface:: SourceExecutorListOptions } ;
66use axum:: {
7+ Json ,
78 extract:: { Path , State } ,
89 http:: StatusCode ,
9- Json ,
1010} ;
1111use axum_extra:: extract:: Query ;
1212
@@ -18,20 +18,39 @@ pub async fn list_flows(
1818 ) )
1919}
2020
21- pub async fn get_flow_spec (
21+ pub async fn get_flow_schema (
2222 Path ( flow_name) : Path < String > ,
2323 State ( lib_context) : State < Arc < LibContext > > ,
24- ) -> Result < Json < spec :: FlowInstanceSpec > , ApiError > {
24+ ) -> Result < Json < FlowSchema > , ApiError > {
2525 let flow_ctx = lib_context. get_flow_context ( & flow_name) ?;
26- Ok ( Json ( flow_ctx. flow . flow_instance . clone ( ) ) )
26+ Ok ( Json ( flow_ctx. flow . data_schema . clone ( ) ) )
2727}
2828
29- pub async fn get_flow_schema (
29+ #[ derive( Serialize ) ]
30+ pub struct GetFlowResponse {
31+ flow_spec : spec:: FlowInstanceSpec ,
32+ data_schema : FlowSchema ,
33+ fingerprint : utils:: fingerprint:: Fingerprint ,
34+ }
35+
36+ pub async fn get_flow (
3037 Path ( flow_name) : Path < String > ,
3138 State ( lib_context) : State < Arc < LibContext > > ,
32- ) -> Result < Json < FlowSchema > , ApiError > {
39+ ) -> Result < Json < GetFlowResponse > , ApiError > {
3340 let flow_ctx = lib_context. get_flow_context ( & flow_name) ?;
34- Ok ( Json ( flow_ctx. flow . data_schema . clone ( ) ) )
41+ let flow_spec = flow_ctx. flow . flow_instance . clone ( ) ;
42+ let data_schema = flow_ctx. flow . data_schema . clone ( ) ;
43+ let fingerprint = utils:: fingerprint:: Fingerprinter :: default ( )
44+ . with ( & flow_spec)
45+ . map_err ( |e| api_error ! ( "failed to fingerprint flow spec: {e}" ) ) ?
46+ . with ( & data_schema)
47+ . map_err ( |e| api_error ! ( "failed to fingerprint data schema: {e}" ) ) ?
48+ . into_fingerprint ( ) ;
49+ Ok ( Json ( GetFlowResponse {
50+ flow_spec,
51+ data_schema,
52+ fingerprint,
53+ } ) )
3554}
3655
3756#[ derive( Deserialize ) ]
0 commit comments