Skip to content

Commit 7cb4eea

Browse files
trivikrsrchase
authored andcommitted
Support List<String> in function parameters list (smithy-lang#516)
1 parent 2191967 commit 7cb4eea

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
@@ -159,6 +159,14 @@ static List<String> getFunctionParametersList(Map<String, Object> paramsMap) {
159159
functionParametersList.add(String.format("%s: '%s'", key, value));
160160
} else if (value instanceof Boolean) {
161161
functionParametersList.add(String.format("%s: %s", key, value));
162+
} else if (value instanceof List) {
163+
if (!((List) value).isEmpty() && !(((List) value).get(0) instanceof String)) {
164+
throw new CodegenException("Plugin function parameters not supported for type List<"
165+
+ ((List) value).get(0).getClass() + ">");
166+
}
167+
functionParametersList.add(String.format("%s: [%s]",
168+
key, ((List<String>) value).stream()
169+
.collect(Collectors.joining("\", \"", "\"", "\""))));
162170
} else {
163171
// Future support for param type should be added in else if.
164172
throw new CodegenException("Plugin function parameters not supported for type "

0 commit comments

Comments
 (0)