Skip to content

Commit 22b1e84

Browse files
committed
Fix stack overflow recursion when storing a result without a type specified
1 parent d6bd6ff commit 22b1e84

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

templates/swift/Sources/Services/Service.swift.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ open class {{ service.name | caseUcfirst }}: Service {
2828
{{ parameter.name | caseCamel | escapeKeyword }}: {% if parameter.type == "object" %}T{% else %}{{ parameter | typeName | raw }}{% endif %}{% if not parameter.required %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %}
2929

3030
{%~ endfor %}
31+
{%~ if method.responseModel | hasGenericType(spec) %}
32+
nestedType: T.Type,
33+
{%~ endif %}
3134
{%~ if 'multipart/form-data' in method.consumes %}
3235
onProgress: ((UploadProgress) -> Void)? = nil
3336
{%~ endif %}
@@ -100,6 +103,7 @@ open class {{ service.name | caseUcfirst }}: Service {
100103
{{ parameter.name | caseCamel | escapeKeyword }}: {{ parameter.name | caseCamel | escapeKeyword }}{% if not loop.last %},{% endif %}
101104

102105
{%~ endfor %}
106+
nestedType: [String: AnyCodable].self
103107
{%~ if 'multipart/form-data' in method.consumes %}
104108
onProgress: onProgress
105109
{%~ endif %}

0 commit comments

Comments
 (0)