[swift3] Swift3 code generator & templates fixed to support additional properties, updated petstore for CI (#5407)

This commit is contained in:
Daniel Woodel
2017-04-27 18:58:54 +01:00
committed by wing328
parent b964994f00
commit bfae01cd35
33 changed files with 117 additions and 38 deletions

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import io.swagger.codegen.*;
import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.Operation;
import io.swagger.models.Swagger;
import io.swagger.models.parameters.HeaderParameter;
@@ -62,6 +63,16 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
return "Generates a swift client library.";
}
@Override
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) {
final Property additionalProperties = swaggerModel.getAdditionalProperties();
if(additionalProperties != null) {
codegenModel.additionalPropertiesType = getSwaggerType(additionalProperties);
}
}
public Swift3Codegen() {
super();
outputFolder = "generated-code" + File.separator + "swift";
@@ -349,7 +360,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
if (p instanceof MapProperty) {
MapProperty ap = (MapProperty) p;
String inner = getSwaggerType(ap.getAdditionalProperties());
return "[String:" + inner + "]";
return inner;
} else if (p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
String inner = getSwaggerType(ap.getItems());