mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
[swift 4] improve test suite (#4561)
* [swift] improve testing in sample projects * [swift] update run tests script * [swift] regenerate samples * [swift] fix tests with PromiseKit * [swift4] compile every project with swift package manager
This commit is contained in:
parent
f434b5fa13
commit
51aeb6c833
@ -27,16 +27,16 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekit --generate-alias-as-model $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekitLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/promisekit
|
||||
cd samples/client/petstore/swift4/promisekitLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/promisekit
|
||||
cd samples/client/petstore/swift4/promisekitLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
@ -27,16 +27,16 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswift --generate-alias-as-model $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswiftLibrary --generate-alias-as-model $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
if type "xcodegen" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/rxswift
|
||||
cd samples/client/petstore/swift4/rxswiftLibrary
|
||||
xcodegen generate
|
||||
fi
|
||||
|
||||
if type "swiftlint" > /dev/null 2>&1; then
|
||||
cd samples/client/petstore/swift4/rxswift
|
||||
cd samples/client/petstore/swift4/rxswiftLibrary
|
||||
swiftlint autocorrect
|
||||
fi
|
@ -43,18 +43,18 @@ playground.xcworkspace
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
Carthage/Checkouts
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
|
||||
|
@ -1 +1 @@
|
||||
4.2.0-SNAPSHOT
|
||||
4.2.2-SNAPSHOT
|
16
samples/client/petstore/swift4/default/Package.resolved
Normal file
16
samples/client/petstore/swift4/default/Package.resolved
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "Alamofire",
|
||||
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "747c8db8d57b68d5e35275f10c92d55f982adbd4",
|
||||
"version": "4.9.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
@ -305,6 +305,7 @@
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
Base,
|
||||
en,
|
||||
);
|
||||
mainGroup = 5FBA6AE5F64CD737F88B4565;
|
||||
|
@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
@ -22,7 +22,7 @@ public struct APIHelper {
|
||||
|
||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||
return source.reduce(into: [String: String]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? Array<Any?> {
|
||||
if let collection = source as? [Any?] {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,7 @@ public struct APIHelper {
|
||||
|
||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
@ -1,5 +1,8 @@
|
||||
platform :ios, '9.0'
|
||||
|
||||
source 'https://cdn.cocoapods.org/'
|
||||
|
||||
use_frameworks!
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
target 'SwaggerClient' do
|
||||
pod "PetstoreClient", :path => "../"
|
||||
|
@ -7,7 +7,7 @@ DEPENDENCIES:
|
||||
- PetstoreClient (from `../`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/CocoaPods/Specs.git:
|
||||
trunk:
|
||||
- Alamofire
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
@ -18,6 +18,6 @@ SPEC CHECKSUMS:
|
||||
Alamofire: afc3e7c6db61476cb45cdd23fed06bad03bbc321
|
||||
PetstoreClient: e5c71b862a32097342e341f7088805bbfc033a3e
|
||||
|
||||
PODFILE CHECKSUM: cedb3058b02f4776d7c31f6d92ae2f674fdf424d
|
||||
PODFILE CHECKSUM: 509bec696cc1d8641751b52e4fe4bef04ac4542c
|
||||
|
||||
COCOAPODS: 1.8.0.beta.2
|
||||
COCOAPODS: 1.8.4
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=12.4" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=12.4" | xcpretty && exit ${PIPESTATUS[0]}
|
||||
pod install
|
||||
|
||||
xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]}
|
||||
|
43
samples/client/petstore/swift4/default/pom.xml
Normal file
43
samples/client/petstore/swift4/default/pom.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>Swift4PetstoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Swift4 Swagger Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>xcodebuild-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>./run_spmbuild.sh</executable>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
3
samples/client/petstore/swift4/default/run_spmbuild.sh
Executable file
3
samples/client/petstore/swift4/default/run_spmbuild.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
swift build && exit ${PIPESTATUS[0]}
|
@ -43,18 +43,18 @@ playground.xcworkspace
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
Carthage/Checkouts
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
|
@ -1 +1 @@
|
||||
4.2.0-SNAPSHOT
|
||||
4.2.2-SNAPSHOT
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "Alamofire",
|
||||
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "747c8db8d57b68d5e35275f10c92d55f982adbd4",
|
||||
"version": "4.9.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
@ -28,7 +28,6 @@
|
||||
40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */; };
|
||||
418DB36F23C53C6E2C3CDE39 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A235FA3FDFB086CC69CDE83D /* Alamofire.framework */; };
|
||||
41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */; };
|
||||
45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D22BE01748F51106DE02332 /* AnimalFarm.swift */; };
|
||||
4884A65ABBA468278D2450FD /* AdditionalPropertiesString.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFE215C1B526E0418ED301B1 /* AdditionalPropertiesString.swift */; };
|
||||
4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */; };
|
||||
4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */; };
|
||||
@ -68,7 +67,6 @@
|
||||
DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E00950725DC44436C5E238C /* FakeAPI.swift */; };
|
||||
DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */; };
|
||||
E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F2985D01F8D60A4B1925C69 /* Category.swift */; };
|
||||
EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */; };
|
||||
EF35D2C67E3BC377DDCC99CB /* AdditionalPropertiesBoolean.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC24C01A55F644957196F9F /* AdditionalPropertiesBoolean.swift */; };
|
||||
FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
@ -91,7 +89,6 @@
|
||||
396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdditionalPropertiesClass.swift; sourceTree = "<group>"; };
|
||||
3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatAllOf.swift; sourceTree = "<group>"; };
|
||||
3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassModel.swift; sourceTree = "<group>"; };
|
||||
47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBooleanMap.swift; sourceTree = "<group>"; };
|
||||
4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumClass.swift; sourceTree = "<group>"; };
|
||||
4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileSchemaTestClass.swift; sourceTree = "<group>"; };
|
||||
4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HasOnlyReadOnly.swift; sourceTree = "<group>"; };
|
||||
@ -109,7 +106,6 @@
|
||||
84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlamofireImplementations.swift; sourceTree = "<group>"; };
|
||||
8699F7966F748ED026A6FB4C /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = "<group>"; };
|
||||
897716962D472FE162B723CB /* APIHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = "<group>"; };
|
||||
8D22BE01748F51106DE02332 /* AnimalFarm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalFarm.swift; sourceTree = "<group>"; };
|
||||
95568E7C35F119EB4A12B498 /* Animal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animal.swift; sourceTree = "<group>"; };
|
||||
9791B840B8D6EAA35343B00F /* JSONEncodableEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEncodableEncoding.swift; sourceTree = "<group>"; };
|
||||
9A019F500E546A3292CE716A /* PetAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PetAPI.swift; sourceTree = "<group>"; };
|
||||
@ -173,7 +169,6 @@
|
||||
72FEDC94BA0E37214D360871 /* AdditionalPropertiesObject.swift */,
|
||||
FFE215C1B526E0418ED301B1 /* AdditionalPropertiesString.swift */,
|
||||
95568E7C35F119EB4A12B498 /* Animal.swift */,
|
||||
8D22BE01748F51106DE02332 /* AnimalFarm.swift */,
|
||||
A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */,
|
||||
7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */,
|
||||
B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */,
|
||||
@ -206,7 +201,6 @@
|
||||
6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */,
|
||||
C81447828475F76C5CF4F08A /* Return.swift */,
|
||||
386FD590658E90509C121118 /* SpecialModelName.swift */,
|
||||
47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */,
|
||||
B2896F8BFD1AA2965C8A3015 /* Tag.swift */,
|
||||
EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */,
|
||||
19B65C66C97F082718DDD703 /* TypeHolderExample.swift */,
|
||||
@ -329,6 +323,7 @@
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
Base,
|
||||
en,
|
||||
);
|
||||
mainGroup = 5FBA6AE5F64CD737F88B4565;
|
||||
@ -357,7 +352,6 @@
|
||||
4884A65ABBA468278D2450FD /* AdditionalPropertiesString.swift in Sources */,
|
||||
40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */,
|
||||
2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */,
|
||||
45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */,
|
||||
CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */,
|
||||
0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */,
|
||||
4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */,
|
||||
@ -401,7 +395,6 @@
|
||||
A6E50CC6845FE58D8C236253 /* Return.swift in Sources */,
|
||||
294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */,
|
||||
CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */,
|
||||
EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */,
|
||||
B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */,
|
||||
5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */,
|
||||
FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */,
|
||||
|
@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
@ -22,7 +22,7 @@ public struct APIHelper {
|
||||
|
||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||
return source.reduce(into: [String: String]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? Array<Any?> {
|
||||
if let collection = source as? [Any?] {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,7 @@ public struct APIHelper {
|
||||
|
||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// Order.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Order: Codable {
|
||||
|
||||
public enum Status: String, Codable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
case delivered = "delivered"
|
||||
}
|
||||
public var _id: Int64?
|
||||
public var petId: Int64?
|
||||
public var quantity: Int?
|
||||
public var shipDate: Date?
|
||||
/** Order Status */
|
||||
public var status: Status?
|
||||
public var complete: Bool? = false
|
||||
|
||||
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
|
||||
self._id = _id
|
||||
self.petId = petId
|
||||
self.quantity = quantity
|
||||
self.shipDate = shipDate
|
||||
self.status = status
|
||||
self.complete = complete
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
case petId
|
||||
case quantity
|
||||
case shipDate
|
||||
case status
|
||||
case complete
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// Pet.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
|
||||
public enum Status: String, Codable {
|
||||
case available = "available"
|
||||
case pending = "pending"
|
||||
case sold = "sold"
|
||||
}
|
||||
public var _id: Int64?
|
||||
public var category: Category?
|
||||
public var name: String
|
||||
public var photoUrls: [String]
|
||||
public var tags: [Tag]?
|
||||
/** pet status in the store */
|
||||
public var status: Status?
|
||||
|
||||
public init(_id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
|
||||
self._id = _id
|
||||
self.category = category
|
||||
self.name = name
|
||||
self.photoUrls = photoUrls
|
||||
self.tags = tags
|
||||
self.status = status
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
case category
|
||||
case name
|
||||
case photoUrls
|
||||
case tags
|
||||
case status
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
//
|
||||
// Tag.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Tag: Codable {
|
||||
|
||||
public var _id: Int64?
|
||||
public var name: String?
|
||||
|
||||
public init(_id: Int64?, name: String?) {
|
||||
self._id = _id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
case name
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
//
|
||||
// User.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct User: Codable {
|
||||
|
||||
public var _id: Int64?
|
||||
public var username: String?
|
||||
public var firstName: String?
|
||||
public var lastName: String?
|
||||
public var email: String?
|
||||
public var password: String?
|
||||
public var phone: String?
|
||||
/** User Status */
|
||||
public var userStatus: Int?
|
||||
|
||||
public init(_id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
|
||||
self._id = _id
|
||||
self.username = username
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.phone = phone
|
||||
self.userStatus = userStatus
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
case username
|
||||
case firstName
|
||||
case lastName
|
||||
case email
|
||||
case password
|
||||
case phone
|
||||
case userStatus
|
||||
}
|
||||
|
||||
}
|
43
samples/client/petstore/swift4/objcCompatible/pom.xml
Normal file
43
samples/client/petstore/swift4/objcCompatible/pom.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>Swift4PetstoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Swift4 Swagger Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>xcodebuild-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>./run_spmbuild.sh</executable>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
3
samples/client/petstore/swift4/objcCompatible/run_spmbuild.sh
Executable file
3
samples/client/petstore/swift4/objcCompatible/run_spmbuild.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
swift build && exit ${PIPESTATUS[0]}
|
@ -1 +0,0 @@
|
||||
4.2.0-SNAPSHOT
|
@ -1,106 +0,0 @@
|
||||
//
|
||||
// XmlItem.swift
|
||||
//
|
||||
// Generated by openapi-generator
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct XmlItem: Codable {
|
||||
|
||||
public var attributeString: String?
|
||||
public var attributeNumber: Double?
|
||||
public var attributeInteger: Int?
|
||||
public var attributeBoolean: Bool?
|
||||
public var wrappedArray: [Int]?
|
||||
public var nameString: String?
|
||||
public var nameNumber: Double?
|
||||
public var nameInteger: Int?
|
||||
public var nameBoolean: Bool?
|
||||
public var nameArray: [Int]?
|
||||
public var nameWrappedArray: [Int]?
|
||||
public var prefixString: String?
|
||||
public var prefixNumber: Double?
|
||||
public var prefixInteger: Int?
|
||||
public var prefixBoolean: Bool?
|
||||
public var prefixArray: [Int]?
|
||||
public var prefixWrappedArray: [Int]?
|
||||
public var namespaceString: String?
|
||||
public var namespaceNumber: Double?
|
||||
public var namespaceInteger: Int?
|
||||
public var namespaceBoolean: Bool?
|
||||
public var namespaceArray: [Int]?
|
||||
public var namespaceWrappedArray: [Int]?
|
||||
public var prefixNsString: String?
|
||||
public var prefixNsNumber: Double?
|
||||
public var prefixNsInteger: Int?
|
||||
public var prefixNsBoolean: Bool?
|
||||
public var prefixNsArray: [Int]?
|
||||
public var prefixNsWrappedArray: [Int]?
|
||||
|
||||
public init(attributeString: String?, attributeNumber: Double?, attributeInteger: Int?, attributeBoolean: Bool?, wrappedArray: [Int]?, nameString: String?, nameNumber: Double?, nameInteger: Int?, nameBoolean: Bool?, nameArray: [Int]?, nameWrappedArray: [Int]?, prefixString: String?, prefixNumber: Double?, prefixInteger: Int?, prefixBoolean: Bool?, prefixArray: [Int]?, prefixWrappedArray: [Int]?, namespaceString: String?, namespaceNumber: Double?, namespaceInteger: Int?, namespaceBoolean: Bool?, namespaceArray: [Int]?, namespaceWrappedArray: [Int]?, prefixNsString: String?, prefixNsNumber: Double?, prefixNsInteger: Int?, prefixNsBoolean: Bool?, prefixNsArray: [Int]?, prefixNsWrappedArray: [Int]?) {
|
||||
self.attributeString = attributeString
|
||||
self.attributeNumber = attributeNumber
|
||||
self.attributeInteger = attributeInteger
|
||||
self.attributeBoolean = attributeBoolean
|
||||
self.wrappedArray = wrappedArray
|
||||
self.nameString = nameString
|
||||
self.nameNumber = nameNumber
|
||||
self.nameInteger = nameInteger
|
||||
self.nameBoolean = nameBoolean
|
||||
self.nameArray = nameArray
|
||||
self.nameWrappedArray = nameWrappedArray
|
||||
self.prefixString = prefixString
|
||||
self.prefixNumber = prefixNumber
|
||||
self.prefixInteger = prefixInteger
|
||||
self.prefixBoolean = prefixBoolean
|
||||
self.prefixArray = prefixArray
|
||||
self.prefixWrappedArray = prefixWrappedArray
|
||||
self.namespaceString = namespaceString
|
||||
self.namespaceNumber = namespaceNumber
|
||||
self.namespaceInteger = namespaceInteger
|
||||
self.namespaceBoolean = namespaceBoolean
|
||||
self.namespaceArray = namespaceArray
|
||||
self.namespaceWrappedArray = namespaceWrappedArray
|
||||
self.prefixNsString = prefixNsString
|
||||
self.prefixNsNumber = prefixNsNumber
|
||||
self.prefixNsInteger = prefixNsInteger
|
||||
self.prefixNsBoolean = prefixNsBoolean
|
||||
self.prefixNsArray = prefixNsArray
|
||||
self.prefixNsWrappedArray = prefixNsWrappedArray
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case attributeString = "attribute_string"
|
||||
case attributeNumber = "attribute_number"
|
||||
case attributeInteger = "attribute_integer"
|
||||
case attributeBoolean = "attribute_boolean"
|
||||
case wrappedArray = "wrapped_array"
|
||||
case nameString = "name_string"
|
||||
case nameNumber = "name_number"
|
||||
case nameInteger = "name_integer"
|
||||
case nameBoolean = "name_boolean"
|
||||
case nameArray = "name_array"
|
||||
case nameWrappedArray = "name_wrapped_array"
|
||||
case prefixString = "prefix_string"
|
||||
case prefixNumber = "prefix_number"
|
||||
case prefixInteger = "prefix_integer"
|
||||
case prefixBoolean = "prefix_boolean"
|
||||
case prefixArray = "prefix_array"
|
||||
case prefixWrappedArray = "prefix_wrapped_array"
|
||||
case namespaceString = "namespace_string"
|
||||
case namespaceNumber = "namespace_number"
|
||||
case namespaceInteger = "namespace_integer"
|
||||
case namespaceBoolean = "namespace_boolean"
|
||||
case namespaceArray = "namespace_array"
|
||||
case namespaceWrappedArray = "namespace_wrapped_array"
|
||||
case prefixNsString = "prefix_ns_string"
|
||||
case prefixNsNumber = "prefix_ns_number"
|
||||
case prefixNsInteger = "prefix_ns_integer"
|
||||
case prefixNsBoolean = "prefix_ns_boolean"
|
||||
case prefixNsArray = "prefix_ns_array"
|
||||
case prefixNsWrappedArray = "prefix_ns_wrapped_array"
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
PODS:
|
||||
- Alamofire (4.9.0)
|
||||
- PetstoreClient (1.0.0):
|
||||
- Alamofire (~> 4.9.0)
|
||||
- PromiseKit/CorePromise (~> 4.4.0)
|
||||
- PromiseKit/CorePromise (4.4.4)
|
||||
|
||||
DEPENDENCIES:
|
||||
- PetstoreClient (from `../`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/CocoaPods/Specs.git:
|
||||
- Alamofire
|
||||
- PromiseKit
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
PetstoreClient:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Alamofire: afc3e7c6db61476cb45cdd23fed06bad03bbc321
|
||||
PetstoreClient: 16d0f56d050fe19acef55197555f60526cf4a71b
|
||||
PromiseKit: 6178219c4c7457ae90d7d8b34b7ac5eb36916519
|
||||
|
||||
PODFILE CHECKSUM: cedb3058b02f4776d7c31f6d92ae2f674fdf424d
|
||||
|
||||
COCOAPODS: 1.8.0.beta.2
|
@ -43,18 +43,18 @@ playground.xcworkspace
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
Carthage/Checkouts
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
|
@ -1,11 +1,11 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
@ -0,0 +1 @@
|
||||
4.2.2-SNAPSHOT
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "Alamofire",
|
||||
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "747c8db8d57b68d5e35275f10c92d55f982adbd4",
|
||||
"version": "4.9.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "PromiseKit",
|
||||
"repositoryURL": "https://github.com/mxcl/PromiseKit.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "80963d4317bcdc03891e0fbaa744f20511d1bc08",
|
||||
"version": "6.12.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
@ -22,7 +22,6 @@
|
||||
34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */ = {isa = PBXBuildFile; fileRef = B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */; };
|
||||
3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */; };
|
||||
37DEADD6CD0496690725B8A7 /* Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AD994DFAA0DA93C188A4DBA /* Name.swift */; };
|
||||
3EA765BDC5A11401D8A16536 /* XmlItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2253391845B73B8BA368049 /* XmlItem.swift */; };
|
||||
40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DF825B8F3BADA2B2537D17 /* APIs.swift */; };
|
||||
40E46046D2B16D1A672A08E3 /* AlamofireImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A201508DF2B697D65F2631 /* AlamofireImplementations.swift */; };
|
||||
418DB36F23C53C6E2C3CDE39 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A235FA3FDFB086CC69CDE83D /* Alamofire.framework */; };
|
||||
@ -106,7 +105,6 @@
|
||||
9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MixedPropertiesAndAdditionalPropertiesClass.swift; sourceTree = "<group>"; };
|
||||
9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnotherFakeAPI.swift; sourceTree = "<group>"; };
|
||||
A21A69C8402A60E01116ABBD /* DogAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogAllOf.swift; sourceTree = "<group>"; };
|
||||
A2253391845B73B8BA368049 /* XmlItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XmlItem.swift; sourceTree = "<group>"; };
|
||||
A235FA3FDFB086CC69CDE83D /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Alamofire.framework; sourceTree = "<group>"; };
|
||||
A53274D99BBDE1B79BF3521C /* StoreAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreAPI.swift; sourceTree = "<group>"; };
|
||||
A586582C92491DF9C12D27E2 /* PromiseKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PromiseKit.framework; sourceTree = "<group>"; };
|
||||
@ -193,7 +191,6 @@
|
||||
EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */,
|
||||
19B65C66C97F082718DDD703 /* TypeHolderExample.swift */,
|
||||
E5565A447062C7B8F695F451 /* User.swift */,
|
||||
A2253391845B73B8BA368049 /* XmlItem.swift */,
|
||||
);
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
@ -312,6 +309,7 @@
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
Base,
|
||||
en,
|
||||
);
|
||||
mainGroup = 5FBA6AE5F64CD737F88B4565;
|
||||
@ -383,7 +381,6 @@
|
||||
FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */,
|
||||
31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */,
|
||||
64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */,
|
||||
3EA765BDC5A11401D8A16536 /* XmlItem.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
@ -22,7 +22,7 @@ public struct APIHelper {
|
||||
|
||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||
return source.reduce(into: [String: String]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? Array<Any?> {
|
||||
if let collection = source as? [Any?] {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,7 @@ public struct APIHelper {
|
||||
|
||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user