From 29d4c76041e5b96765c4f0af74b6ec3bd92e55a4 Mon Sep 17 00:00:00 2001 From: fernando-apollo Date: Wed, 26 Oct 2022 15:13:43 +0100 Subject: [PATCH 1/3] convert to string to get the contents --- apollo-router/src/plugins/rhai.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apollo-router/src/plugins/rhai.rs b/apollo-router/src/plugins/rhai.rs index 55518a6dcb..be4e28a992 100644 --- a/apollo-router/src/plugins/rhai.rs +++ b/apollo-router/src/plugins/rhai.rs @@ -390,7 +390,7 @@ impl Plugin for Rhai { let engine = Arc::new(Rhai::new_rhai_engine(Some(scripts_path))); let ast = engine.compile_file(main)?; let mut scope = Scope::new(); - scope.push_constant("apollo_sdl", sdl); + scope.push_constant("apollo_sdl", sdl.to_string()); scope.push_constant("apollo_start", Instant::now()); // Run the AST with our scope to put any global variables From 8583c042a279328a7bfc459edaf7919e28cba96b Mon Sep 17 00:00:00 2001 From: fernando-apollo Date: Wed, 26 Oct 2022 15:48:37 +0100 Subject: [PATCH 2/3] updated changelog for issue 2005 --- NEXT_CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index f9999eb181..08a317ceea 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -28,6 +28,12 @@ By [@USERNAME](https://github.com/USERNAME) in https://github.com/apollographql/ ## ❗ BREAKING ❗ ## 🚀 Features ## 🐛 Fixes + +### Fix the rhai SDL print function [Issue #2005](https://github.com/apollographql/router/issues/2005)) + +A recent change to the way we provide the SDL to plugins broke the rhai SDL print. This fixes it. + +By [@fernando-apollo](https://github.com/fernando-apollo) in https://github.com/apollographql/router/pull/2007 ## 🛠 Maintenance ### Split the configuration file management in multiple modules [Issue #1790](https://github.com/apollographql/router/issues/1790)) From e799db265077a5976e1608fc9365c7cb5ad42d79 Mon Sep 17 00:00:00 2001 From: fernando-apollo Date: Wed, 26 Oct 2022 16:15:41 +0100 Subject: [PATCH 3/3] use the right type when retrieving the sdl --- apollo-router/src/plugins/rhai.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apollo-router/src/plugins/rhai.rs b/apollo-router/src/plugins/rhai.rs index be4e28a992..0308b190a9 100644 --- a/apollo-router/src/plugins/rhai.rs +++ b/apollo-router/src/plugins/rhai.rs @@ -1589,7 +1589,7 @@ mod tests { let mut guard = scope.lock().unwrap(); // Call our function to make sure we can access the sdl - let sdl: Arc = rhai_instance + let sdl: String = rhai_instance .engine .call_fn(&mut guard, &rhai_instance.ast, "get_sdl", ()) .expect("can get sdl");