Skip to content

Commit 81217ee

Browse files
committed
chore: x-available-languages
1 parent 402ccca commit 81217ee

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation>
114114

115115
throw new CTSException("Cannot find operation for method: " + step.method, test.testName);
116116
}
117+
118+
boolean isHelper = (boolean) ope.vendorExtensions.getOrDefault("x-helper", false);
119+
120+
if (isHelper) {
121+
List<String> availableLanguages = (List<String>) ope.vendorExtensions.getOrDefault(
122+
"x-available-languages",
123+
new ArrayList<>()
124+
);
125+
126+
if (availableLanguages.size() > 0 && !availableLanguages.contains(language)) {
127+
continue skipTest;
128+
}
129+
}
130+
117131
stepOut.put("stepTemplate", "tests/client/method.mustache");
118132
stepOut.put("isMethod", true); // TODO: remove once kotlin is converted
119133
stepOut.put("hasParams", ope.hasParams);
@@ -123,7 +137,6 @@ public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation>
123137
stepOut.put("returnsBoolean", ope.returnType.equals("Boolean")); // ruby requires a ? for boolean functions.
124138
}
125139

126-
boolean isHelper = (boolean) ope.vendorExtensions.getOrDefault("x-helper", false);
127140
stepOut.put("isHelper", isHelper);
128141
// default to true because most api calls are asynchronous
129142
stepOut.put("isAsyncMethod", (boolean) ope.vendorExtensions.getOrDefault("x-asynchronous-helper", true));

specs/search/helpers/accountCopyIndex.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
method:
22
get:
33
x-helper: true
4+
x-available-languages:
5+
- javascript
46
tags:
57
- Account
68
operationId: accountCopyIndex

0 commit comments

Comments
 (0)