Skip to content

Commit 5739f4d

Browse files
committed
Added JSON parsing
1 parent b2cb602 commit 5739f4d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

templates/cli/lib/commands/command.js.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
5555
payload['{{ parameter.name }}'] = filePath;
5656
}
5757

58+
{% elseif parameter.type == 'object' %}
59+
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') {
60+
payload['{{ parameter.name }}'] = JSON.parse({{ parameter.name | caseCamel | escapeKeyword}});
61+
}
62+
5863
{% else %}
5964
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') {
6065
payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword}}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %}.toString(){% endif %};

0 commit comments

Comments
 (0)