forked from loafle/openapi-generator-original
parent
b74c1b98a2
commit
148a842f3b
@ -347,10 +347,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
List<Map<String, String>> swiftEnums = new ArrayList<Map<String, String>>();
|
||||
List<String> values = (List<String>) codegenProperty.allowableValues.get("values");
|
||||
|
||||
for (String value : values) {
|
||||
for (Object value : values) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("enum", toSwiftyEnumName(value));
|
||||
map.put("raw", value);
|
||||
map.put("enum", toSwiftyEnumName(String.valueOf(value)));
|
||||
map.put("raw", String.valueOf(value));
|
||||
swiftEnums.add(map);
|
||||
}
|
||||
codegenProperty.allowableValues.put("values", swiftEnums);
|
||||
|
@ -108,13 +108,13 @@ public class PetAPI: APIBase {
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- examples: [{contentType=application/json, example={
|
||||
- examples: [{example={
|
||||
"name" : "Puma",
|
||||
"type" : "Dog",
|
||||
"color" : "Black",
|
||||
"gender" : "Female",
|
||||
"breed" : "Mixed"
|
||||
}}]
|
||||
}, contentType=application/json}]
|
||||
|
||||
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
|
||||
|
||||
@ -157,20 +157,20 @@ public class PetAPI: APIBase {
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- examples: [{contentType=application/json, example=[ {
|
||||
"photoUrls" : [ "aeiou" ],
|
||||
"name" : "doggie",
|
||||
- examples: [{example=[ {
|
||||
"tags" : [ {
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
} ],
|
||||
"id" : 123456789,
|
||||
"category" : {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
} ],
|
||||
"status" : "aeiou"
|
||||
} ]}, {contentType=application/xml, example=<Pet>
|
||||
"status" : "aeiou",
|
||||
"name" : "doggie",
|
||||
"photoUrls" : [ "aeiou" ]
|
||||
} ], contentType=application/json}, {example=<Pet>
|
||||
<id>123456</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
@ -179,21 +179,21 @@ public class PetAPI: APIBase {
|
||||
<tags>
|
||||
</tags>
|
||||
<status>string</status>
|
||||
</Pet>}]
|
||||
- examples: [{contentType=application/json, example=[ {
|
||||
"photoUrls" : [ "aeiou" ],
|
||||
"name" : "doggie",
|
||||
</Pet>, contentType=application/xml}]
|
||||
- examples: [{example=[ {
|
||||
"tags" : [ {
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
} ],
|
||||
"id" : 123456789,
|
||||
"category" : {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
} ],
|
||||
"status" : "aeiou"
|
||||
} ]}, {contentType=application/xml, example=<Pet>
|
||||
"status" : "aeiou",
|
||||
"name" : "doggie",
|
||||
"photoUrls" : [ "aeiou" ]
|
||||
} ], contentType=application/json}, {example=<Pet>
|
||||
<id>123456</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
@ -202,7 +202,7 @@ public class PetAPI: APIBase {
|
||||
<tags>
|
||||
</tags>
|
||||
<status>string</status>
|
||||
</Pet>}]
|
||||
</Pet>, contentType=application/xml}]
|
||||
|
||||
- parameter tags: (query) Tags to filter by (optional)
|
||||
|
||||
@ -242,26 +242,26 @@ public class PetAPI: APIBase {
|
||||
Find pet by ID
|
||||
- GET /pet/{petId}
|
||||
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- API Key:
|
||||
- type: apiKey api_key
|
||||
- name: api_key
|
||||
- examples: [{contentType=application/json, example={
|
||||
"photoUrls" : [ "aeiou" ],
|
||||
"name" : "doggie",
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- examples: [{example={
|
||||
"tags" : [ {
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
} ],
|
||||
"id" : 123456789,
|
||||
"category" : {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
} ],
|
||||
"status" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<Pet>
|
||||
"status" : "aeiou",
|
||||
"name" : "doggie",
|
||||
"photoUrls" : [ "aeiou" ]
|
||||
}, contentType=application/json}, {example=<Pet>
|
||||
<id>123456</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
@ -270,21 +270,21 @@ public class PetAPI: APIBase {
|
||||
<tags>
|
||||
</tags>
|
||||
<status>string</status>
|
||||
</Pet>}]
|
||||
- examples: [{contentType=application/json, example={
|
||||
"photoUrls" : [ "aeiou" ],
|
||||
"name" : "doggie",
|
||||
</Pet>, contentType=application/xml}]
|
||||
- examples: [{example={
|
||||
"tags" : [ {
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
} ],
|
||||
"id" : 123456789,
|
||||
"category" : {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
"id" : 123456789,
|
||||
"name" : "aeiou"
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "aeiou",
|
||||
"id" : 123456789
|
||||
} ],
|
||||
"status" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<Pet>
|
||||
"status" : "aeiou",
|
||||
"name" : "doggie",
|
||||
"photoUrls" : [ "aeiou" ]
|
||||
}, contentType=application/json}, {example=<Pet>
|
||||
<id>123456</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
@ -293,7 +293,7 @@ public class PetAPI: APIBase {
|
||||
<tags>
|
||||
</tags>
|
||||
<status>string</status>
|
||||
</Pet>}]
|
||||
</Pet>, contentType=application/xml}]
|
||||
|
||||
- parameter petId: (path) ID of pet that needs to be fetched
|
||||
|
||||
|
@ -67,12 +67,12 @@ public class StoreAPI: APIBase {
|
||||
- API Key:
|
||||
- type: apiKey api_key
|
||||
- name: api_key
|
||||
- examples: [{contentType=application/json, example={
|
||||
- examples: [{example={
|
||||
"key" : 123
|
||||
}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}]
|
||||
- examples: [{contentType=application/json, example={
|
||||
}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}]
|
||||
- examples: [{example={
|
||||
"key" : 123
|
||||
}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}]
|
||||
}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}]
|
||||
|
||||
- returns: RequestBuilder<[String:Int32]>
|
||||
*/
|
||||
@ -108,36 +108,36 @@ public class StoreAPI: APIBase {
|
||||
Find purchase order by ID
|
||||
- GET /store/order/{orderId}
|
||||
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
- examples: [{contentType=application/json, example={
|
||||
"petId" : 123456789,
|
||||
"quantity" : 123,
|
||||
- examples: [{example={
|
||||
"id" : 123456789,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"petId" : 123456789,
|
||||
"complete" : true,
|
||||
"status" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<Order>
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00"
|
||||
}, contentType=application/json}, {example=<Order>
|
||||
<id>123456</id>
|
||||
<petId>123456</petId>
|
||||
<quantity>0</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>string</status>
|
||||
<complete>true</complete>
|
||||
</Order>}]
|
||||
- examples: [{contentType=application/json, example={
|
||||
"petId" : 123456789,
|
||||
"quantity" : 123,
|
||||
</Order>, contentType=application/xml}]
|
||||
- examples: [{example={
|
||||
"id" : 123456789,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"petId" : 123456789,
|
||||
"complete" : true,
|
||||
"status" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<Order>
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00"
|
||||
}, contentType=application/json}, {example=<Order>
|
||||
<id>123456</id>
|
||||
<petId>123456</petId>
|
||||
<quantity>0</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>string</status>
|
||||
<complete>true</complete>
|
||||
</Order>}]
|
||||
</Order>, contentType=application/xml}]
|
||||
|
||||
- parameter orderId: (path) ID of pet that needs to be fetched
|
||||
|
||||
@ -176,36 +176,36 @@ public class StoreAPI: APIBase {
|
||||
Place an order for a pet
|
||||
- POST /store/order
|
||||
-
|
||||
- examples: [{contentType=application/json, example={
|
||||
"petId" : 123456789,
|
||||
"quantity" : 123,
|
||||
- examples: [{example={
|
||||
"id" : 123456789,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"petId" : 123456789,
|
||||
"complete" : true,
|
||||
"status" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<Order>
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00"
|
||||
}, contentType=application/json}, {example=<Order>
|
||||
<id>123456</id>
|
||||
<petId>123456</petId>
|
||||
<quantity>0</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>string</status>
|
||||
<complete>true</complete>
|
||||
</Order>}]
|
||||
- examples: [{contentType=application/json, example={
|
||||
"petId" : 123456789,
|
||||
"quantity" : 123,
|
||||
</Order>, contentType=application/xml}]
|
||||
- examples: [{example={
|
||||
"id" : 123456789,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"petId" : 123456789,
|
||||
"complete" : true,
|
||||
"status" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<Order>
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00"
|
||||
}, contentType=application/json}, {example=<Order>
|
||||
<id>123456</id>
|
||||
<petId>123456</petId>
|
||||
<quantity>0</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>string</status>
|
||||
<complete>true</complete>
|
||||
</Order>}]
|
||||
</Order>, contentType=application/xml}]
|
||||
|
||||
- parameter body: (body) order placed for purchasing the pet (optional)
|
||||
|
||||
|
@ -167,16 +167,16 @@ public class UserAPI: APIBase {
|
||||
Get user by user name
|
||||
- GET /user/{username}
|
||||
-
|
||||
- examples: [{contentType=application/json, example={
|
||||
"firstName" : "aeiou",
|
||||
"lastName" : "aeiou",
|
||||
"password" : "aeiou",
|
||||
"userStatus" : 123,
|
||||
"phone" : "aeiou",
|
||||
- examples: [{example={
|
||||
"id" : 123456789,
|
||||
"lastName" : "aeiou",
|
||||
"phone" : "aeiou",
|
||||
"username" : "aeiou",
|
||||
"email" : "aeiou",
|
||||
"username" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<User>
|
||||
"userStatus" : 123,
|
||||
"firstName" : "aeiou",
|
||||
"password" : "aeiou"
|
||||
}, contentType=application/json}, {example=<User>
|
||||
<id>123456</id>
|
||||
<username>string</username>
|
||||
<firstName>string</firstName>
|
||||
@ -185,17 +185,17 @@ public class UserAPI: APIBase {
|
||||
<password>string</password>
|
||||
<phone>string</phone>
|
||||
<userStatus>0</userStatus>
|
||||
</User>}]
|
||||
- examples: [{contentType=application/json, example={
|
||||
"firstName" : "aeiou",
|
||||
"lastName" : "aeiou",
|
||||
"password" : "aeiou",
|
||||
"userStatus" : 123,
|
||||
"phone" : "aeiou",
|
||||
</User>, contentType=application/xml}]
|
||||
- examples: [{example={
|
||||
"id" : 123456789,
|
||||
"lastName" : "aeiou",
|
||||
"phone" : "aeiou",
|
||||
"username" : "aeiou",
|
||||
"email" : "aeiou",
|
||||
"username" : "aeiou"
|
||||
}}, {contentType=application/xml, example=<User>
|
||||
"userStatus" : 123,
|
||||
"firstName" : "aeiou",
|
||||
"password" : "aeiou"
|
||||
}, contentType=application/json}, {example=<User>
|
||||
<id>123456</id>
|
||||
<username>string</username>
|
||||
<firstName>string</firstName>
|
||||
@ -204,7 +204,7 @@ public class UserAPI: APIBase {
|
||||
<password>string</password>
|
||||
<phone>string</phone>
|
||||
<userStatus>0</userStatus>
|
||||
</User>}]
|
||||
</User>, contentType=application/xml}]
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
@ -244,8 +244,8 @@ public class UserAPI: APIBase {
|
||||
Logs user into the system
|
||||
- GET /user/login
|
||||
-
|
||||
- examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}]
|
||||
- examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}]
|
||||
- examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}]
|
||||
- examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}]
|
||||
|
||||
- parameter username: (query) The user name for login (optional)
|
||||
- parameter password: (query) The password for login in clear text (optional)
|
||||
|
@ -8,7 +8,7 @@ DEPENDENCIES:
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
PetstoreClient:
|
||||
:path: ../
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0
|
||||
@ -16,4 +16,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 84472aca2a88b7f7ed9fcd63e9f5fdb5ad4aab94
|
||||
|
||||
COCOAPODS: 1.0.1
|
||||
COCOAPODS: 1.0.0
|
||||
|
@ -48,8 +48,8 @@ EOM
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
;;
|
||||
*.xib)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}"
|
||||
;;
|
||||
*.framework)
|
||||
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
@ -48,8 +48,8 @@ EOM
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
;;
|
||||
*.xib)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}"
|
||||
;;
|
||||
*.framework)
|
||||
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
@ -143,12 +143,15 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6D4EFBAE1C692C6300B96B06 /* Build configuration list for PBXNativeTarget "SwaggerClient" */;
|
||||
buildPhases = (
|
||||
CF310079E3CB0BE5BE604471 /* 📦 Check Pods Manifest.lock */,
|
||||
1F03F780DC2D9727E5E64BA9 /* [CP] Check Pods Manifest.lock */,
|
||||
6D4EFB8D1C692C6300B96B06 /* Sources */,
|
||||
6D4EFB8E1C692C6300B96B06 /* Frameworks */,
|
||||
6D4EFB8F1C692C6300B96B06 /* Resources */,
|
||||
4485A75250058E2D5BBDF63F /* [CP] Embed Pods Frameworks */,
|
||||
808CE4A0CE801CAC5ABF5B08 /* [CP] Copy Pods Resources */,
|
||||
3D9471620628F03313096EB2 /* 📦 Embed Pods Frameworks */,
|
||||
EEEC2B2D0497D38CEAD2DB24 /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -163,12 +166,15 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6D4EFBB11C692C6300B96B06 /* Build configuration list for PBXNativeTarget "SwaggerClientTests" */;
|
||||
buildPhases = (
|
||||
B4DB169E5F018305D6759D34 /* 📦 Check Pods Manifest.lock */,
|
||||
79FE27B09B2DD354C831BD49 /* [CP] Check Pods Manifest.lock */,
|
||||
6D4EFBA11C692C6300B96B06 /* Sources */,
|
||||
6D4EFBA21C692C6300B96B06 /* Frameworks */,
|
||||
6D4EFBA31C692C6300B96B06 /* Resources */,
|
||||
796EAD48F1BCCDAA291CD963 /* [CP] Embed Pods Frameworks */,
|
||||
1652CB1A246A4689869E442D /* [CP] Copy Pods Resources */,
|
||||
ECE47F6BF90C3848F6E94AFF /* 📦 Embed Pods Frameworks */,
|
||||
1494090872F3F18E536E8902 /* 📦 Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -239,6 +245,21 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
1494090872F3F18E536E8902 /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClientTests/Pods-SwaggerClientTests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
1652CB1A246A4689869E442D /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -269,6 +290,21 @@
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3D9471620628F03313096EB2 /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
4485A75250058E2D5BBDF63F /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -329,6 +365,66 @@
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
B4DB169E5F018305D6759D34 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
CF310079E3CB0BE5BE604471 /* 📦 Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
ECE47F6BF90C3848F6E94AFF /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClientTests/Pods-SwaggerClientTests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
EEEC2B2D0497D38CEAD2DB24 /* 📦 Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "📦 Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient/Pods-SwaggerClient-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
|
@ -4,7 +4,7 @@ Pod::Spec.new do |s|
|
||||
s.osx.deployment_target = '10.9'
|
||||
s.version = '0.0.1'
|
||||
s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }
|
||||
s.authors =
|
||||
s.authors = ''
|
||||
s.license = 'Apache License, Version 2.0'
|
||||
s.homepage = 'https://github.com/swagger-api/swagger-codegen'
|
||||
s.summary = 'PetstoreClient'
|
||||
|
@ -37,6 +37,9 @@ public class RequestBuilder<T> {
|
||||
let method: String
|
||||
let URLString: String
|
||||
|
||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||
public var onProgressReady: ((NSProgress) -> ())?
|
||||
|
||||
required public init(method: String, URLString: String, parameters: [String:AnyObject]?, isBody: Bool) {
|
||||
self.method = method
|
||||
self.URLString = URLString
|
||||
|
@ -57,15 +57,22 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
||||
encodingMemoryThreshold: Manager.MultipartFormDataEncodingMemoryThreshold,
|
||||
encodingCompletion: { encodingResult in
|
||||
switch encodingResult {
|
||||
case .Success(let upload, _, _):
|
||||
self.processRequest(upload, managerId, completion)
|
||||
case .Success(let uploadRequest, _, _):
|
||||
if let onProgressReady = self.onProgressReady {
|
||||
onProgressReady(uploadRequest.progress)
|
||||
}
|
||||
self.processRequest(uploadRequest, managerId, completion)
|
||||
case .Failure(let encodingError):
|
||||
completion(response: nil, error: encodingError)
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
processRequest(manager.request(xMethod!, URLString, parameters: parameters, encoding: encoding), managerId, completion)
|
||||
let request = manager.request(xMethod!, URLString, parameters: parameters, encoding: encoding)
|
||||
if let onProgressReady = self.onProgressReady {
|
||||
onProgressReady(request.progress)
|
||||
}
|
||||
processRequest(request, managerId, completion)
|
||||
}
|
||||
|
||||
}
|
||||
@ -75,8 +82,36 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
||||
request.authenticate(usingCredential: credential)
|
||||
}
|
||||
|
||||
request.validate().responseJSON(options: .AllowFragments) { response in
|
||||
let cleanupRequest = {
|
||||
managerStore.removeValueForKey(managerId)
|
||||
}
|
||||
|
||||
let validatedRequest = request.validate()
|
||||
|
||||
switch T.self {
|
||||
case is NSData.Type:
|
||||
validatedRequest.responseData({ (dataResponse) in
|
||||
cleanupRequest()
|
||||
|
||||
if (dataResponse.result.isFailure) {
|
||||
completion(
|
||||
response: nil,
|
||||
error: dataResponse.result.error
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
completion(
|
||||
response: Response(
|
||||
response: dataResponse.response!,
|
||||
body: dataResponse.data as! T
|
||||
),
|
||||
error: nil
|
||||
)
|
||||
})
|
||||
default:
|
||||
validatedRequest.responseJSON(options: .AllowFragments) { response in
|
||||
cleanupRequest()
|
||||
|
||||
if response.result.isFailure {
|
||||
completion(response: nil, error: response.result.error)
|
||||
@ -101,6 +136,7 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
||||
completion(response: nil, error: NSError(domain: "localhost", code: 500, userInfo: ["reason": "unreacheable code"]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func buildHeaders() -> [String: AnyObject] {
|
||||
var httpHeaders = Manager.defaultHTTPHeaders
|
||||
|
@ -59,6 +59,11 @@ extension Dictionary: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension NSData: JSONEncodable {
|
||||
func encodeToJSON() -> AnyObject {
|
||||
return self.base64EncodedStringWithOptions(NSDataBase64EncodingOptions())
|
||||
}
|
||||
}
|
||||
|
||||
private let dateFormatter: NSDateFormatter = {
|
||||
let fmt = NSDateFormatter()
|
||||
@ -73,6 +78,12 @@ extension NSDate: JSONEncodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension NSUUID: JSONEncodable {
|
||||
func encodeToJSON() -> AnyObject {
|
||||
return self.UUIDString
|
||||
}
|
||||
}
|
||||
|
||||
extension RequestBuilder {
|
||||
public func execute() -> Promise<Response<T>> {
|
||||
let deferred = Promise<Response<T>>.pendingPromise()
|
||||
|
@ -62,9 +62,15 @@ class Decoders {
|
||||
if T.self is Int64.Type && source is NSNumber {
|
||||
return source.longLongValue as! T;
|
||||
}
|
||||
if T.self is NSUUID.Type && source is String {
|
||||
return NSUUID(UUIDString: source as! String) as! T
|
||||
}
|
||||
if source is T {
|
||||
return source as! T
|
||||
}
|
||||
if T.self is NSData.Type && source is String {
|
||||
return NSData(base64EncodedString: source as! String, options: NSDataBase64DecodingOptions()) as! T
|
||||
}
|
||||
|
||||
let key = "\(T.self)"
|
||||
if let decoder = decoders[key] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user