From dbc5c4cac828bbc29447178f73c2f079f97ee5f6 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 29 Jan 2025 15:58:58 +0100 Subject: [PATCH] reset the context --- .../main/java/com/algolia/codegen/cts/tests/Snippet.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/generators/src/main/java/com/algolia/codegen/cts/tests/Snippet.java b/generators/src/main/java/com/algolia/codegen/cts/tests/Snippet.java index ccf3452c60..8a927974d7 100644 --- a/generators/src/main/java/com/algolia/codegen/cts/tests/Snippet.java +++ b/generators/src/main/java/com/algolia/codegen/cts/tests/Snippet.java @@ -38,7 +38,14 @@ public String toString() { } public void addMethodCall(Map context, ParametersWithDataType paramsType, CodegenOperation ope) throws CTSException { + // for dynamic snippets, we need to reset the context because the order if generation is random context.put("method", method); + context.put("returnType", null); + context.put("requestOptions", null); + context.put("parameters", null); + context.put("parametersWithDataType", null); + context.put("parametersWithDataTypeMap", null); + if (ope.returnType != null && ope.returnType.length() > 0) { context.put("returnType", camelize(ope.returnType)); }