Skip to content

Commit

Permalink
[swift5] Map file and binary to Data
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed May 25, 2021
1 parent 6c40192 commit acc9895
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public Swift5ClientCodegen() {
"Bool",
"Void",
"String",
"URL",
"Data",
"Date",
"Character",
Expand Down Expand Up @@ -224,8 +223,8 @@ public Swift5ClientCodegen() {
typeMapping.put("float", "Float");
typeMapping.put("number", "Double");
typeMapping.put("double", "Double");
typeMapping.put("file", "URL");
typeMapping.put("binary", "URL");
typeMapping.put("file", "Data");
typeMapping.put("binary", "Data");
typeMapping.put("ByteArray", "Data");
typeMapping.put("UUID", "UUID");
typeMapping.put("URI", "String");
Expand Down Expand Up @@ -602,7 +601,7 @@ public String getSchemaType(Schema p) {

@Override
public boolean isDataTypeFile(String dataType) {
return "URL".equals(dataType);
return "Data".equals(dataType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public void binaryDataTest() {
final Operation p = openAPI.getPaths().get(path).getPost();
final CodegenOperation op = codegen.fromOperation(path, "post", p, null);

Assert.assertEquals(op.returnType, "URL");
Assert.assertEquals(op.bodyParam.dataType, "URL");
Assert.assertEquals(op.returnType, "Data");
Assert.assertEquals(op.bodyParam.dataType, "Data");
Assert.assertTrue(op.bodyParam.isBinary);
Assert.assertTrue(op.responses.get(0).isBinary);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public void simpleModelTest() {

final CodegenProperty property4 = cm.vars.get(3);
Assert.assertEquals(property4.baseName, "binary");
Assert.assertEquals(property4.dataType, "URL");
Assert.assertEquals(property4.dataType, "Data");
Assert.assertEquals(property4.name, "binary");
Assert.assertNull(property4.defaultValue);
Assert.assertEquals(property4.baseType, "URL");
Assert.assertEquals(property4.baseType, "Data");
Assert.assertFalse(property4.required);
Assert.assertFalse(property4.isContainer);

Expand Down

0 comments on commit acc9895

Please sign in to comment.