Skip to content

Commit d02ff59

Browse files
authored
Support List<String> in function parameters list (#516)
1 parent 1837734 commit d02ff59

File tree

1 file changed

+8
-0
lines changed
  • smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen

1 file changed

+8
-0
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CodegenUtils.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ static List<String> getFunctionParametersList(Map<String, Object> paramsMap) {
164164
functionParametersList.add(String.format("%s: '%s'", key, value));
165165
} else if (value instanceof Boolean) {
166166
functionParametersList.add(String.format("%s: %s", key, value));
167+
} else if (value instanceof List) {
168+
if (!((List) value).isEmpty() && !(((List) value).get(0) instanceof String)) {
169+
throw new CodegenException("Plugin function parameters not supported for type List<"
170+
+ ((List) value).get(0).getClass() + ">");
171+
}
172+
functionParametersList.add(String.format("%s: [%s]",
173+
key, ((List<String>) value).stream()
174+
.collect(Collectors.joining("\", \"", "\"", "\""))));
167175
} else {
168176
// Future support for param type should be added in else if.
169177
throw new CodegenException("Plugin function parameters not supported for type "

0 commit comments

Comments
 (0)