forked from loafle/openapi-generator-original
update doc, better code format
This commit is contained in:
parent
0c8481b8c7
commit
8b2e25e4da
@ -13,7 +13,6 @@ sidebar_label: swift4
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|projectName|Project name in Xcode| |null|
|
||||
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null|
|
||||
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
|
||||
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|
||||
|podSource|Source information used for Podspec| |null|
|
||||
|podVersion|Version used for Podspec| |null|
|
||||
|
@ -124,8 +124,8 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
// Added for Objective-C compatibility
|
||||
"id", "description", "NSArray", "NSURL", "CGFloat", "NSSet", "NSString", "NSInteger", "NSUInteger",
|
||||
"NSError", "NSDictionary"
|
||||
)
|
||||
);
|
||||
)
|
||||
);
|
||||
|
||||
reservedWords = new HashSet<>(
|
||||
Arrays.asList(
|
||||
@ -847,18 +847,6 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
|
||||
// The default template code has the following logic for
|
||||
// assigning a type as Swift Optional:
|
||||
//
|
||||
// {{^unwrapRequired}}?{{/unwrapRequired}}
|
||||
// {{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}
|
||||
//
|
||||
// which means:
|
||||
//
|
||||
// boolean isSwiftOptional = !unwrapRequired || (unwrapRequired && !property.required);
|
||||
//
|
||||
// We can drop the check for unwrapRequired in (unwrapRequired && !property.required)
|
||||
// due to short-circuit evaluation of the || operator.
|
||||
boolean isSwiftScalarType = property.isInteger || property.isLong || property.isFloat
|
||||
|| property.isDouble || property.isBoolean;
|
||||
if ((!property.required || property.isNullable) && isSwiftScalarType) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user