From 735f7e8167e7405c2ed49b54ba81cfa2f5a01614 Mon Sep 17 00:00:00 2001 From: Marcus Wu Date: Thu, 12 Dec 2019 00:16:46 +0800 Subject: [PATCH 1/3] Fix issue #208 and update expected result --- Specs/Petstore/generated/Swift/Sources/API.swift | 4 ++-- Templates/Swift/Sources/API.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Specs/Petstore/generated/Swift/Sources/API.swift b/Specs/Petstore/generated/Swift/Sources/API.swift index e914c0630..9a7d34428 100644 --- a/Specs/Petstore/generated/Swift/Sources/API.swift +++ b/Specs/Petstore/generated/Swift/Sources/API.swift @@ -25,8 +25,8 @@ public struct Petstore { /** Test environment **/ public static func test(space: String = "main", version: String = "v1") -> String { var url = "https://test.petstore.com/{version}/{space}" - url = url.replacingOccurrences(of: "{\(space)}", with: space) - url = url.replacingOccurrences(of: "{\(version)}", with: version) + url = url.replacingOccurrences(of: "{space}", with: space) + url = url.replacingOccurrences(of: "{version}", with: version) return url } diff --git a/Templates/Swift/Sources/API.swift b/Templates/Swift/Sources/API.swift index f08a09b7a..cceeace8e 100644 --- a/Templates/Swift/Sources/API.swift +++ b/Templates/Swift/Sources/API.swift @@ -33,10 +33,10 @@ public struct {{ options.name }} { /** {{ server.description }} **/ {% endif %} {% if server.variables %} - public static func {{ server.name }}({% for variable in server.variables %}{{ variable.name }}: String = "{{ variable.defaultValue}}"{% ifnot forloop.last %}, {% endif %}{% endfor %}) -> String { + public static func {{ server.name }}({% for variable in server.variables %}{{ variable.name }}: String = "{{ variable.defaultValue }}"{% ifnot forloop.last %}, {% endif %}{% endfor %}) -> String { var url = "{{ server.url }}" {% for variable in server.variables %} - url = url.replacingOccurrences(of: "{\({{variable.name}})}", with: {{variable.name}}) + url = url.replacingOccurrences(of: {{'"{'}}{{variable.name}}{{'}"'}}, with: {{variable.name}}) {% endfor %} return url } From 5cdc8fe38a1178aa9f7766fcfb7371867a7f1275 Mon Sep 17 00:00:00 2001 From: Marcus Wu Date: Thu, 12 Dec 2019 15:46:37 +0800 Subject: [PATCH 2/3] Add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23d71a643..c74831a70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log ## Next Version +### Fixed +- Fixed `'??' has non-optional type` warning #207 +- Fixed wrong replacing string in variable server #208 + ## 4.3.0 ### Added From fae82399e8f49e3a2c34a60d0eb1f1aedac0674a Mon Sep 17 00:00:00 2001 From: Marcus Wu Date: Thu, 12 Dec 2019 16:23:12 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md Co-Authored-By: Yonas Kolb --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c74831a70..696f78fb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### Fixed - Fixed `'??' has non-optional type` warning #207 -- Fixed wrong replacing string in variable server #208 +- Fixed incorrect replacements in server variables #209 ## 4.3.0