diff --git a/lib/objc-codegen.js b/lib/objc-codegen.js index 1a61b1f..38f1b24 100644 --- a/lib/objc-codegen.js +++ b/lib/objc-codegen.js @@ -296,6 +296,11 @@ function addObjCMethodInfo(meta, method, modelName, skipOptionalArguments) { var paramAssignments; var bodyParamAssignments; method.accepts.forEach(function (param) { + // Skip arguments derived by a server-side code + if (isServerComputedArg(param)) { + return; + } + var paramRequired = param.required || (param.http && param.http.source === 'body'); if (!paramRequired && skipOptionalArguments) { return; @@ -376,6 +381,9 @@ function addObjCMethodInfo(meta, method, modelName, skipOptionalArguments) { function hasOptionalArguments(method) { for (var idx in method.accepts) { var param = method.accepts[idx]; + if (isServerComputedArg(param)) { + continue; + } var paramRequired = param.required || (param.http && param.http.source === 'body'); if (!paramRequired) { return true; @@ -384,6 +392,17 @@ function hasOptionalArguments(method) { return false; } +function isServerComputedArg(param) { + if (typeof param.http === 'function') { + return true; + } + + var httpSource = param.http && param.http.source; + return httpSource === 'req' || + httpSource === 'res' || + httpSource === 'context'; +} + function convertToObjCPropType(type) { if (Array.isArray(type)) { return propTypeConversionTable['']; diff --git a/test-env/client/ios/CodeGenTest/CodeGenTest.xcodeproj/project.pbxproj b/test-env/client/ios/CodeGenTest/CodeGenTest.xcodeproj/project.pbxproj index 77478e8..e0843c4 100644 --- a/test-env/client/ios/CodeGenTest/CodeGenTest.xcodeproj/project.pbxproj +++ b/test-env/client/ios/CodeGenTest/CodeGenTest.xcodeproj/project.pbxproj @@ -325,7 +325,7 @@ ); 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"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 9A86B9E429A6B7474DC3F9C1 /* [CP] Embed Pods Frameworks */ = { @@ -370,7 +370,7 @@ ); 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"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; F1E01B4ABA5E5A9760F3CC39 /* [CP] Embed Pods Frameworks */ = {