Skip to content

Commit

Permalink
Fix optional wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Oct 23, 2024
1 parent b4bb9da commit 86ebddc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion templates/apple/Sources/Client.swift.twig
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ open class Client {
encodedParams[key] = param
} else if let encodable = param as? Encodable {
encodedParams[key] = try encodable.toJson()
} else {
} else if let param = param {
encodedParams[key] = String(describing: param)
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/swift/Sources/Client.swift.twig
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ open class Client {
encodedParams[key] = param
} else if let encodable = param as? Encodable {
encodedParams[key] = try encodable.toJson()
} else {
} else if let param = param {
encodedParams[key] = String(describing: param)
}
}
Expand Down
7 changes: 1 addition & 6 deletions templates/swift/Sources/Enums/Enum.swift.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public enum {{ enum.name | caseUcfirst | overrideIdentifier }}: String, CustomStringConvertible, Codable {
public enum {{ enum.name | caseUcfirst | overrideIdentifier }}: String, CustomStringConvertible {
{%~ for value in enum.enum %}
{%~ set key = enum.keys is empty ? value : enum.keys[loop.index0] %}
case {{ key | caseEnumKey | escapeSwiftKeyword }} = "{{ value }}"
Expand All @@ -9,9 +9,4 @@ public enum {{ enum.name | caseUcfirst | overrideIdentifier }}: String, CustomSt
public var description: String {
return rawValue
}

public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(rawValue)
}
}
17 changes: 5 additions & 12 deletions tests/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,11 @@ public function setUp(): void

$this->expectedOutput[] = $headers;

// Figure out if mock-server is running
$isMockAPIRunning = \strlen(\exec('docker ps | grep mock-server')) > 0;

if (!$isMockAPIRunning) {
echo "Starting Mock API Server";

\exec('
cd ./mock-server && \
docker compose build && \
docker compose up -d --force-recreate
');
}
\exec('
cd ./mock-server && \
docker compose build && \
docker compose up -d --force-recreate
');
}

public function tearDown(): void
Expand Down

0 comments on commit 86ebddc

Please sign in to comment.