Merge pull request #3404 from wing328/objc_fix_empty_desc

To set a default description if none is provided
This commit is contained in:
wing328
2016-07-19 17:09:01 +08:00
committed by GitHub
7 changed files with 63 additions and 57 deletions

View File

@@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.*;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import org.apache.commons.lang3.StringUtils;
public class DefaultGenerator extends AbstractGenerator implements Generator {
protected Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
@@ -149,10 +149,16 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
if (info.getVersion() != null) {
config.additionalProperties().put("appVersion", config.escapeText(info.getVersion()));
}
if (info.getDescription() != null) {
if (StringUtils.isEmpty(info.getDescription())) {
// set a default description if none if provided
config.additionalProperties().put("appDescription",
"No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)");
} else {
config.additionalProperties().put("appDescription",
config.escapeText(info.getDescription()));
}
if (info.getContact() != null) {
Contact contact = info.getContact();
config.additionalProperties().put("infoUrl", config.escapeText(contact.getUrl()));
@@ -522,7 +528,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (SupportingFile support : config.supportingFiles()) {
try {
String outputFolder = config.outputFolder();
if (isNotEmpty(support.folder)) {
if (StringUtils.isNotEmpty(support.folder)) {
outputFolder += File.separator + support.folder;
}
File of = new File(outputFolder);

View File

@@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
- API version: 1.0.0
- Package version:
- Build date: 2016-06-16T11:33:34.619+02:00
- Build date: 2016-07-19T16:53:26.476+08:00
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
## Requirements
@@ -74,9 +74,9 @@ SWGPet* *body = [[SWGPet alloc] init]; // Pet object that needs to be added to t
SWGPetApi *apiInstance = [[SWGPetApi alloc] init];
// Add a new pet to the store
// Add a new pet to the store
[apiInstance addPetWithBody:body
completionHandler: ^(NSError* error)) {
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error: %@", error);
}
@@ -124,6 +124,12 @@ Class | Method | HTTP request | Description
## Documentation For Authorization
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## petstore_auth
- **Type**: OAuth
@@ -133,12 +139,6 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Author

View File

@@ -376,7 +376,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
// Authentication setting
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@@ -110,13 +110,6 @@
- (NSDictionary *) authSettings {
return @{
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
@"api_key":
@{
@"type": @"api_key",
@@ -124,6 +117,13 @@
@"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"]
},
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
};
}

View File

@@ -214,12 +214,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */;
buildPhases = (
799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */,
799E7E29D924C30424DFBA28 /* 📦 Check Pods Manifest.lock */,
6003F586195388D20070C39A /* Sources */,
6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */,
429AF5C69E165ED75311B4B0 /* Copy Pods Resources */,
183E54C09C54DAEB54B2546F /* Embed Pods Frameworks */,
429AF5C69E165ED75311B4B0 /* 📦 Copy Pods Resources */,
183E54C09C54DAEB54B2546F /* 📦 Embed Pods Frameworks */,
);
buildRules = (
);
@@ -234,12 +234,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */;
buildPhases = (
7B069562A9F91E498732474F /* Check Pods Manifest.lock */,
7B069562A9F91E498732474F /* 📦 Check Pods Manifest.lock */,
6003F5AA195388D20070C39A /* Sources */,
6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */,
E337D7E459CCFFDF27046FFC /* Copy Pods Resources */,
111D7956304BD6E860AA8709 /* Embed Pods Frameworks */,
E337D7E459CCFFDF27046FFC /* 📦 Copy Pods Resources */,
111D7956304BD6E860AA8709 /* 📦 Embed Pods Frameworks */,
);
buildRules = (
);
@@ -303,14 +303,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
111D7956304BD6E860AA8709 /* Embed Pods Frameworks */ = {
111D7956304BD6E860AA8709 /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -318,14 +318,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
183E54C09C54DAEB54B2546F /* Embed Pods Frameworks */ = {
183E54C09C54DAEB54B2546F /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -333,14 +333,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
429AF5C69E165ED75311B4B0 /* Copy Pods Resources */ = {
429AF5C69E165ED75311B4B0 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -348,14 +348,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */ = {
799E7E29D924C30424DFBA28 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -363,14 +363,14 @@
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;
};
7B069562A9F91E498732474F /* Check Pods Manifest.lock */ = {
7B069562A9F91E498732474F /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -378,14 +378,14 @@
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;
};
E337D7E459CCFFDF27046FFC /* Copy Pods Resources */ = {
E337D7E459CCFFDF27046FFC /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;

View File

@@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
- API version: 1.0.0
- Package version:
- Build date: 2016-07-03T21:49:00.509+08:00
- Build date: 2016-07-19T16:53:24.981+08:00
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
## Requirements

View File

@@ -232,12 +232,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */;
buildPhases = (
799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */,
799E7E29D924C30424DFBA28 /* 📦 Check Pods Manifest.lock */,
6003F586195388D20070C39A /* Sources */,
6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */,
429AF5C69E165ED75311B4B0 /* Copy Pods Resources */,
183E54C09C54DAEB54B2546F /* Embed Pods Frameworks */,
429AF5C69E165ED75311B4B0 /* 📦 Copy Pods Resources */,
183E54C09C54DAEB54B2546F /* 📦 Embed Pods Frameworks */,
);
buildRules = (
);
@@ -252,12 +252,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */;
buildPhases = (
7B069562A9F91E498732474F /* Check Pods Manifest.lock */,
7B069562A9F91E498732474F /* 📦 Check Pods Manifest.lock */,
6003F5AA195388D20070C39A /* Sources */,
6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */,
E337D7E459CCFFDF27046FFC /* Copy Pods Resources */,
111D7956304BD6E860AA8709 /* Embed Pods Frameworks */,
E337D7E459CCFFDF27046FFC /* 📦 Copy Pods Resources */,
111D7956304BD6E860AA8709 /* 📦 Embed Pods Frameworks */,
);
buildRules = (
);
@@ -321,14 +321,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
111D7956304BD6E860AA8709 /* Embed Pods Frameworks */ = {
111D7956304BD6E860AA8709 /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -336,14 +336,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
183E54C09C54DAEB54B2546F /* Embed Pods Frameworks */ = {
183E54C09C54DAEB54B2546F /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -351,14 +351,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
429AF5C69E165ED75311B4B0 /* Copy Pods Resources */ = {
429AF5C69E165ED75311B4B0 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -366,14 +366,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */ = {
799E7E29D924C30424DFBA28 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -381,14 +381,14 @@
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;
};
7B069562A9F91E498732474F /* Check Pods Manifest.lock */ = {
7B069562A9F91E498732474F /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -396,14 +396,14 @@
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;
};
E337D7E459CCFFDF27046FFC /* Copy Pods Resources */ = {
E337D7E459CCFFDF27046FFC /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;