Skip to content

Commit 87f2ca8

Browse files
committed
chore: snippets also
1 parent 81217ee commit 87f2ca8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,17 @@ private Map<String, Snippet[]> loadSnippets(Map<String, CodegenOperation> operat
6464
for (var step : test.steps) {
6565
if (step.method != null && step.type.equals("method")) {
6666
CodegenOperation ope = operations.get(step.method);
67-
if (ope == null || !(boolean) ope.vendorExtensions.getOrDefault("x-helper", false)) {
67+
boolean isHelper = (boolean) ope.vendorExtensions.getOrDefault("x-helper", false);
68+
if (ope == null || !isHelper) {
6869
continue;
6970
}
71+
72+
List<String> availableLanguages = (List<String>) ope.vendorExtensions.getOrDefault("x-available-languages", new ArrayList<>());
73+
74+
if (availableLanguages.size() > 0 && !availableLanguages.contains(language)) {
75+
continue;
76+
}
77+
7078
Snippet newSnippet = new Snippet(step.method, test.testName, step.parameters, step.requestOptions);
7179
Snippet[] existing = snippets.get(step.method);
7280
if (existing == null) {

0 commit comments

Comments
 (0)