From 32c59b72145367c5396f346069c130c2a03b3421 Mon Sep 17 00:00:00 2001 From: Serhii Tatarintsev Date: Fri, 9 Feb 2024 20:45:41 +0100 Subject: [PATCH] qe: `--enable-playground` automatically enables graphql protocol (#4711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If protocol is not specified explicitly and `--enable-playground` flag is used, engine will default to GraphQL instead of JSON. Close #4679 Co-authored-by: Joël Galeran --- query-engine/query-engine/src/opt.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/query-engine/query-engine/src/opt.rs b/query-engine/query-engine/src/opt.rs index eff1c14d3c6c..fd5639a18573 100644 --- a/query-engine/query-engine/src/opt.rs +++ b/query-engine/query-engine/src/opt.rs @@ -224,7 +224,13 @@ impl PrismaOpt { self.engine_protocol .as_ref() .map(EngineProtocol::from) - .unwrap_or(EngineProtocol::Json) + .unwrap_or_else(|| { + if self.enable_playground { + EngineProtocol::Graphql + } else { + EngineProtocol::Json + } + }) } }