forked from loafle/openapi-generator-original
@@ -127,7 +127,6 @@ public class CSharpModelTest {
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "name");
|
||||
@@ -138,7 +137,6 @@ public class CSharpModelTest {
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertTrue(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
|
||||
final CodegenProperty property3 = cm.vars.get(2);
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
@@ -148,7 +146,6 @@ public class CSharpModelTest {
|
||||
Assert.assertEquals(property3.baseType, "DateTime?");
|
||||
Assert.assertFalse(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertTrue(property3.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with list property")
|
||||
@@ -176,7 +173,6 @@ public class CSharpModelTest {
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
@@ -236,7 +232,6 @@ public class CSharpModelTest {
|
||||
Assert.assertEquals(property1.name, "Children");
|
||||
Assert.assertEquals(property1.baseType, "Children");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex list property")
|
||||
@@ -288,7 +283,6 @@ public class CSharpModelTest {
|
||||
Assert.assertEquals(property1.containerType, "map");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isContainer);
|
||||
Assert.assertFalse(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert an array model")
|
||||
|
||||
@@ -60,7 +60,6 @@ public class GoModelTest {
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "name");
|
||||
@@ -71,7 +70,6 @@ public class GoModelTest {
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertTrue(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
|
||||
final CodegenProperty property3 = cm.vars.get(2);
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
@@ -82,7 +80,6 @@ public class GoModelTest {
|
||||
Assert.assertEquals(property3.baseType, "time.Time");
|
||||
Assert.assertFalse(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertTrue(property3.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with list property")
|
||||
@@ -110,7 +107,6 @@ public class GoModelTest {
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
@@ -121,7 +117,6 @@ public class GoModelTest {
|
||||
Assert.assertEquals(property2.containerType, "array");
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertTrue(property2.isContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with a map property")
|
||||
@@ -169,7 +164,6 @@ public class GoModelTest {
|
||||
Assert.assertEquals(property1.name, "Children");
|
||||
Assert.assertEquals(property1.baseType, "Children");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex list property")
|
||||
@@ -220,7 +214,6 @@ public class GoModelTest {
|
||||
Assert.assertEquals(property1.containerType, "map");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isContainer);
|
||||
Assert.assertFalse(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert an array model")
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.openapitools.codegen.options;
|
||||
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.languages.Swift3Codegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Swift3OptionsProvider implements OptionsProvider {
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String PROJECT_NAME_VALUE = "Swagger";
|
||||
public static final String RESPONSE_AS_VALUE = "test";
|
||||
public static final String UNWRAP_REQUIRED_VALUE = "true";
|
||||
public static final String OBJC_COMPATIBLE_VALUE = "false";
|
||||
public static final String LENIENT_TYPE_CAST_VALUE = "false";
|
||||
public static final String POD_SOURCE_VALUE = "{ :git => 'git@github.com:swagger-api/swagger-mustache.git'," +
|
||||
" :tag => 'v1.0.0-SNAPSHOT' }";
|
||||
public static final String POD_VERSION_VALUE = "v1.0.0-SNAPSHOT";
|
||||
public static final String POD_AUTHORS_VALUE = "podAuthors";
|
||||
public static final String POD_SOCIAL_MEDIA_URL_VALUE = "podSocialMediaURL";
|
||||
public static final String POD_DOCSET_URL_VALUE = "podDocsetURL";
|
||||
public static final String POD_LICENSE_VALUE = "'Apache License, Version 2.0'";
|
||||
public static final String POD_HOMEPAGE_VALUE = "podHomepage";
|
||||
public static final String POD_SUMMARY_VALUE = "podSummary";
|
||||
public static final String POD_DESCRIPTION_VALUE = "podDescription";
|
||||
public static final String POD_SCREENSHOTS_VALUE = "podScreenshots";
|
||||
public static final String POD_DOCUMENTATION_URL_VALUE = "podDocumentationURL";
|
||||
public static final String SWIFT_USE_API_NAMESPACE_VALUE = "swiftUseApiNamespace";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
|
||||
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "swift3";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(Swift3Codegen.PROJECT_NAME, PROJECT_NAME_VALUE)
|
||||
.put(Swift3Codegen.RESPONSE_AS, RESPONSE_AS_VALUE)
|
||||
.put(Swift3Codegen.UNWRAP_REQUIRED, UNWRAP_REQUIRED_VALUE)
|
||||
.put(Swift3Codegen.OBJC_COMPATIBLE, OBJC_COMPATIBLE_VALUE)
|
||||
.put(Swift3Codegen.LENIENT_TYPE_CAST, LENIENT_TYPE_CAST_VALUE)
|
||||
.put(Swift3Codegen.POD_SOURCE, POD_SOURCE_VALUE)
|
||||
.put(CodegenConstants.POD_VERSION, POD_VERSION_VALUE)
|
||||
.put(Swift3Codegen.POD_AUTHORS, POD_AUTHORS_VALUE)
|
||||
.put(Swift3Codegen.POD_SOCIAL_MEDIA_URL, POD_SOCIAL_MEDIA_URL_VALUE)
|
||||
.put(Swift3Codegen.POD_DOCSET_URL, POD_DOCSET_URL_VALUE)
|
||||
.put(Swift3Codegen.POD_LICENSE, POD_LICENSE_VALUE)
|
||||
.put(Swift3Codegen.POD_HOMEPAGE, POD_HOMEPAGE_VALUE)
|
||||
.put(Swift3Codegen.POD_SUMMARY, POD_SUMMARY_VALUE)
|
||||
.put(Swift3Codegen.POD_DESCRIPTION, POD_DESCRIPTION_VALUE)
|
||||
.put(Swift3Codegen.POD_SCREENSHOTS, POD_SCREENSHOTS_VALUE)
|
||||
.put(Swift3Codegen.POD_DOCUMENTATION_URL, POD_DOCUMENTATION_URL_VALUE)
|
||||
.put(Swift3Codegen.SWIFT_USE_API_NAMESPACE, SWIFT_USE_API_NAMESPACE_VALUE)
|
||||
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,6 @@ public class PythonTest {
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "name");
|
||||
@@ -97,7 +96,6 @@ public class PythonTest {
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertTrue(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
|
||||
final CodegenProperty property3 = cm.vars.get(2);
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
@@ -107,7 +105,6 @@ public class PythonTest {
|
||||
Assert.assertEquals(property3.baseType, "datetime");
|
||||
Assert.assertFalse(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertTrue(property3.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with list property")
|
||||
@@ -135,7 +132,6 @@ public class PythonTest {
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
@@ -247,12 +243,11 @@ public class PythonTest {
|
||||
Assert.assertEquals(property1.containerType, "map");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isContainer);
|
||||
Assert.assertFalse(property1.isNotContainer);
|
||||
}
|
||||
|
||||
|
||||
// should not start with 'null'. need help from the community to investigate further
|
||||
@Test(enabled = false, description = "convert an array model")
|
||||
@Test(description = "convert an array model")
|
||||
public void arrayModelTest() {
|
||||
final Schema model = new ArraySchema()
|
||||
//.description()
|
||||
@@ -271,7 +266,7 @@ public class PythonTest {
|
||||
}
|
||||
|
||||
// should not start with 'null'. need help from the community to investigate further
|
||||
@Test(enabled = false, description = "convert an map model")
|
||||
@Test(description = "convert an map model")
|
||||
public void mapModelTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a map model")
|
||||
@@ -284,7 +279,7 @@ public class PythonTest {
|
||||
Assert.assertEquals(cm.description, "a map model");
|
||||
Assert.assertEquals(cm.vars.size(), 0);
|
||||
Assert.assertEquals(cm.parent, "null<String, Children>");
|
||||
Assert.assertEquals(cm.imports.size(), 2); // TODO: need to verify
|
||||
Assert.assertEquals(cm.imports.size(), 1);
|
||||
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.openapitools.codegen.swift3;
|
||||
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.languages.Swift3Codegen;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.parser.OpenAPIParser;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class Swift3CodegenTest {
|
||||
|
||||
Swift3Codegen swiftCodegen = new Swift3Codegen();
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testCapitalizedReservedWord() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("AS", null), "_as");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testReservedWord() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("Public", null), "_public");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void shouldNotBreakNonReservedWord() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("Error", null), "error");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void shouldNotBreakCorrectName() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("EntryName", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testSingleWordAllCaps() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("VALUE", null), "value");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testSingleWordLowercase() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("value", null), "value");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testCapitalsWithUnderscore() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("ENTRY_NAME", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testCapitalsWithDash() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("ENTRY-NAME", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testCapitalsWithSpace() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("ENTRY NAME", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testLowercaseWithUnderscore() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("entry_name", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testStartingWithNumber() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("123EntryName", null), "_123entryName");
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("123Entry_name", null), "_123entryName");
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("123EntryName123", null), "_123entryName123");
|
||||
}
|
||||
|
||||
@Test(description = "returns NSData when response format is binary", enabled = false)
|
||||
public void binaryDataTest() {
|
||||
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/binaryDataTest.json", null, new ParseOptions()).getOpenAPI();
|
||||
final DefaultCodegen codegen = new Swift3Codegen();
|
||||
final String path = "/tests/binaryResponse";
|
||||
final Operation p = openAPI.getPaths().get(path).getPost();
|
||||
final CodegenOperation op = codegen.fromOperation(path, "post", p, openAPI.getComponents().getSchemas());
|
||||
|
||||
Assert.assertEquals(op.returnType, "Data");
|
||||
Assert.assertEquals(op.bodyParam.dataType, "Data");
|
||||
Assert.assertTrue(op.bodyParam.isBinary);
|
||||
Assert.assertTrue(op.responses.get(0).isBinary);
|
||||
}
|
||||
|
||||
@Test(description = "returns ISOFullDate when response format is date", enabled = false)
|
||||
public void dateTest() {
|
||||
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/datePropertyTest.json", null, new ParseOptions()).getOpenAPI();
|
||||
final DefaultCodegen codegen = new Swift3Codegen();
|
||||
final String path = "/tests/dateResponse";
|
||||
final Operation p = openAPI.getPaths().get(path).getPost();
|
||||
final CodegenOperation op = codegen.fromOperation(path, "post", p, openAPI.getComponents().getSchemas());
|
||||
|
||||
Assert.assertEquals(op.returnType, "ISOFullDate");
|
||||
Assert.assertEquals(op.bodyParam.dataType, "ISOFullDate");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testDefaultPodAuthors() throws Exception {
|
||||
// Given
|
||||
|
||||
// When
|
||||
swiftCodegen.processOpts();
|
||||
|
||||
// Then
|
||||
final String podAuthors = (String) swiftCodegen.additionalProperties().get(Swift3Codegen.POD_AUTHORS);
|
||||
Assert.assertEquals(podAuthors, Swift3Codegen.DEFAULT_POD_AUTHORS);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testPodAuthors() throws Exception {
|
||||
// Given
|
||||
final String swaggerDevs = "Swagger Devs";
|
||||
swiftCodegen.additionalProperties().put(Swift3Codegen.POD_AUTHORS, swaggerDevs);
|
||||
|
||||
// When
|
||||
swiftCodegen.processOpts();
|
||||
|
||||
// Then
|
||||
final String podAuthors = (String) swiftCodegen.additionalProperties().get(Swift3Codegen.POD_AUTHORS);
|
||||
Assert.assertEquals(podAuthors, swaggerDevs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.openapitools.codegen.swift3;
|
||||
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.languages.Swift3Codegen;
|
||||
import io.swagger.v3.oas.models.media.BinarySchema;
|
||||
import io.swagger.v3.oas.models.media.ByteArraySchema;
|
||||
import io.swagger.v3.oas.models.media.DateSchema;
|
||||
import io.swagger.v3.oas.models.media.DateTimeSchema;
|
||||
import io.swagger.v3.oas.models.media.Discriminator;
|
||||
import io.swagger.v3.oas.models.media.IntegerSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.media.UUIDSchema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
public class Swift3ModelTest {
|
||||
|
||||
@Test(description = "convert a simple java model")
|
||||
public void simpleModelTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
|
||||
.addProperties("name", new StringSchema())
|
||||
.addProperties("createdAt", new DateTimeSchema())
|
||||
.addProperties("binary", new BinarySchema())
|
||||
.addProperties("byte", new ByteArraySchema())
|
||||
.addProperties("uuid", new UUIDSchema())
|
||||
.addProperties("dateOfBirth", new DateSchema())
|
||||
.addRequiredItem("id")
|
||||
.addRequiredItem("name")
|
||||
.discriminator(new Discriminator().propertyName("test"));
|
||||
|
||||
final DefaultCodegen codegen = new Swift3Codegen();
|
||||
final CodegenModel cm = codegen.fromModel("sample", schema);
|
||||
|
||||
Assert.assertEquals(cm.name, "sample");
|
||||
Assert.assertEquals(cm.classname, "Sample");
|
||||
Assert.assertEquals(cm.description, "a sample model");
|
||||
Assert.assertEquals(cm.vars.size(), 7);
|
||||
Assert.assertEquals(cm.getDiscriminatorName(),"test");
|
||||
|
||||
final CodegenProperty property1 = cm.vars.get(0);
|
||||
Assert.assertEquals(property1.baseName, "id");
|
||||
Assert.assertEquals(property1.datatype, "Int64");
|
||||
Assert.assertEquals(property1.name, "id");
|
||||
Assert.assertNull(property1.defaultValue);
|
||||
Assert.assertEquals(property1.baseType, "Int64");
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isPrimitiveType);
|
||||
Assert.assertFalse(property1.isContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "name");
|
||||
Assert.assertEquals(property2.datatype, "String");
|
||||
Assert.assertEquals(property2.name, "name");
|
||||
Assert.assertNull(property2.defaultValue);
|
||||
Assert.assertEquals(property2.baseType, "String");
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertTrue(property2.required);
|
||||
Assert.assertTrue(property2.isPrimitiveType);
|
||||
Assert.assertFalse(property2.isContainer);
|
||||
|
||||
final CodegenProperty property3 = cm.vars.get(2);
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
Assert.assertEquals(property3.datatype, "Date");
|
||||
Assert.assertEquals(property3.name, "createdAt");
|
||||
Assert.assertNull(property3.defaultValue);
|
||||
Assert.assertEquals(property3.baseType, "Date");
|
||||
Assert.assertTrue(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertFalse(property3.isContainer);
|
||||
|
||||
final CodegenProperty property4 = cm.vars.get(3);
|
||||
Assert.assertEquals(property4.baseName, "binary");
|
||||
Assert.assertEquals(property4.datatype, "URL");
|
||||
Assert.assertEquals(property4.name, "binary");
|
||||
Assert.assertNull(property4.defaultValue);
|
||||
Assert.assertEquals(property4.baseType, "URL");
|
||||
Assert.assertTrue(property4.hasMore);
|
||||
Assert.assertFalse(property4.required);
|
||||
Assert.assertFalse(property4.isContainer);
|
||||
|
||||
final CodegenProperty property5 = cm.vars.get(4);
|
||||
Assert.assertEquals(property5.baseName, "byte");
|
||||
Assert.assertEquals(property5.datatype, "Data");
|
||||
Assert.assertEquals(property5.name, "byte");
|
||||
Assert.assertNull(property5.defaultValue);
|
||||
Assert.assertEquals(property5.baseType, "Data");
|
||||
Assert.assertTrue(property5.hasMore);
|
||||
Assert.assertFalse(property5.required);
|
||||
Assert.assertFalse(property5.isContainer);
|
||||
|
||||
final CodegenProperty property6 = cm.vars.get(5);
|
||||
Assert.assertEquals(property6.baseName, "uuid");
|
||||
Assert.assertEquals(property6.datatype, "UUID");
|
||||
Assert.assertEquals(property6.name, "uuid");
|
||||
Assert.assertNull(property6.defaultValue);
|
||||
Assert.assertEquals(property6.baseType, "UUID");
|
||||
Assert.assertTrue(property6.hasMore);
|
||||
Assert.assertFalse(property6.required);
|
||||
Assert.assertFalse(property6.isContainer);
|
||||
|
||||
final CodegenProperty property7 = cm.vars.get(6);
|
||||
Assert.assertEquals(property7.baseName, "dateOfBirth");
|
||||
Assert.assertEquals(property7.datatype, "ISOFullDate");
|
||||
Assert.assertEquals(property7.name, "dateOfBirth");
|
||||
Assert.assertNull(property7.defaultValue);
|
||||
Assert.assertEquals(property7.baseType, "ISOFullDate");
|
||||
Assert.assertFalse(property7.hasMore);
|
||||
Assert.assertFalse(property7.required);
|
||||
Assert.assertFalse(property7.isContainer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.openapitools.codegen.swift3;
|
||||
|
||||
import org.openapitools.codegen.AbstractOptionsTest;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.languages.Swift3Codegen;
|
||||
import org.openapitools.codegen.options.Swift3OptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class Swift3OptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private Swift3Codegen clientCodegen;
|
||||
|
||||
public Swift3OptionsTest() {
|
||||
super(new Swift3OptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(Swift3OptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setProjectName(Swift3OptionsProvider.PROJECT_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setResponseAs(Swift3OptionsProvider.RESPONSE_AS_VALUE.split(","));
|
||||
times = 1;
|
||||
clientCodegen.setUnwrapRequired(Boolean.valueOf(Swift3OptionsProvider.UNWRAP_REQUIRED_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setObjcCompatible(Boolean.valueOf(Swift3OptionsProvider.OBJC_COMPATIBLE_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setLenientTypeCast(Boolean.valueOf(Swift3OptionsProvider.LENIENT_TYPE_CAST_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(Swift3OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -16,64 +16,64 @@ public class Swift4CodegenTest {
|
||||
|
||||
Swift4Codegen swiftCodegen = new Swift4Codegen();
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testCapitalizedReservedWord() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("AS", null), "_as");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testReservedWord() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("Public", null), "_public");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void shouldNotBreakNonReservedWord() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("Error", null), "error");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void shouldNotBreakCorrectName() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("EntryName", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testSingleWordAllCaps() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("VALUE", null), "value");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testSingleWordLowercase() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("value", null), "value");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testCapitalsWithUnderscore() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("ENTRY_NAME", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testCapitalsWithDash() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("ENTRY-NAME", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testCapitalsWithSpace() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("ENTRY NAME", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testLowercaseWithUnderscore() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("entry_name", null), "entryName");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testStartingWithNumber() throws Exception {
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("123EntryName", null), "_123entryName");
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("123Entry_name", null), "_123entryName");
|
||||
Assert.assertEquals(swiftCodegen.toEnumVarName("123EntryName123", null), "_123entryName123");
|
||||
}
|
||||
|
||||
@Test(description = "returns Data when response format is binary", enabled = false)
|
||||
@Test(description = "returns Data when response format is binary", enabled = true)
|
||||
public void binaryDataTest() {
|
||||
// TODO update json file
|
||||
|
||||
@@ -83,13 +83,13 @@ public class Swift4CodegenTest {
|
||||
final Operation p = openAPI.getPaths().get(path).getPost();
|
||||
final CodegenOperation op = codegen.fromOperation(path, "post", p, openAPI.getComponents().getSchemas());
|
||||
|
||||
Assert.assertEquals(op.returnType, "Data");
|
||||
Assert.assertEquals(op.bodyParam.dataType, "Data");
|
||||
Assert.assertEquals(op.returnType, "URL");
|
||||
Assert.assertEquals(op.bodyParam.dataType, "URL");
|
||||
Assert.assertTrue(op.bodyParam.isBinary);
|
||||
Assert.assertTrue(op.responses.get(0).isBinary);
|
||||
}
|
||||
|
||||
@Test(description = "returns Date when response format is date", enabled = false)
|
||||
@Test(description = "returns Date when response format is date", enabled = true)
|
||||
public void dateTest() {
|
||||
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/datePropertyTest.json", null, new ParseOptions()).getOpenAPI();
|
||||
final DefaultCodegen codegen = new Swift4Codegen();
|
||||
@@ -101,7 +101,7 @@ public class Swift4CodegenTest {
|
||||
Assert.assertEquals(op.bodyParam.dataType, "Date");
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testDefaultPodAuthors() throws Exception {
|
||||
// Given
|
||||
|
||||
@@ -113,7 +113,7 @@ public class Swift4CodegenTest {
|
||||
Assert.assertEquals(podAuthors, Swift4Codegen.DEFAULT_POD_AUTHORS);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = true)
|
||||
public void testPodAuthors() throws Exception {
|
||||
// Given
|
||||
final String openAPIDevs = "OpenAPI Devs";
|
||||
|
||||
@@ -33,7 +33,7 @@ import static io.swagger.codegen.utils.ModelUtils.updateCodegenPropertyEnum;
|
||||
@SuppressWarnings("static-method")
|
||||
public class TypeScriptFetchModelTest {
|
||||
|
||||
@Test(enabled = false, description = "convert a simple TypeScript Angular model")
|
||||
@Test(description = "convert a simple TypeScript Angular model")
|
||||
public void simpleModelTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -93,7 +93,7 @@ public class TypeScriptFetchModelTest {
|
||||
Assert.assertTrue(property4.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert a model with list property")
|
||||
@Test(description = "convert a model with list property")
|
||||
public void listPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -125,10 +125,9 @@ public class TypeScriptFetchModelTest {
|
||||
Assert.assertEquals(property2.baseType, "Array");
|
||||
Assert.assertFalse(property2.hasMore);
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex property", enabled = false)
|
||||
@Test(description = "convert a model with complex property")
|
||||
public void complexPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -148,10 +147,9 @@ public class TypeScriptFetchModelTest {
|
||||
Assert.assertEquals(property1.defaultValue, "undefined");
|
||||
Assert.assertEquals(property1.baseType, "Children");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex list property", enabled = false)
|
||||
@Test(description = "convert a model with complex list property")
|
||||
public void complexListPropertyTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -172,10 +170,9 @@ public class TypeScriptFetchModelTest {
|
||||
Assert.assertEquals(property1.name, "children");
|
||||
Assert.assertEquals(property1.baseType, "Array");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert an array model")
|
||||
@Test(description = "convert an array model")
|
||||
public void arrayModelTest() {
|
||||
final Schema model = new ArraySchema()
|
||||
.items(new Schema().$ref("#/definitions/Children"))
|
||||
@@ -189,7 +186,7 @@ public class TypeScriptFetchModelTest {
|
||||
Assert.assertEquals(cm.vars.size(), 0);
|
||||
}
|
||||
|
||||
@Test(description = "convert a map model", enabled = false)
|
||||
@Test(description = "convert a map model")
|
||||
public void mapModelTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a map model")
|
||||
@@ -205,7 +202,7 @@ public class TypeScriptFetchModelTest {
|
||||
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
|
||||
}
|
||||
|
||||
@Test(description = "test enum array model", enabled = false)
|
||||
@Test(description = "test enum array model")
|
||||
public void enumArrayMdoelTest() {
|
||||
// TODO: update yaml file.
|
||||
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml", null, new ParseOptions()).getOpenAPI();
|
||||
@@ -240,9 +237,9 @@ public class TypeScriptFetchModelTest {
|
||||
|
||||
}
|
||||
|
||||
@Test(description = "test enum model for values (numeric, string, etc)", enabled = false)
|
||||
@Test(description = "test enum model for values (numeric, string, etc)")
|
||||
public void enumMdoelValueTest() {
|
||||
final OpenAPI openAPI = new OpenAPIParser().readContents("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml", null, new ParseOptions()).getOpenAPI();
|
||||
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml", null, new ParseOptions()).getOpenAPI();
|
||||
final DefaultCodegen codegen = new TypeScriptFetchClientCodegen();
|
||||
final Schema schema = openAPI.getComponents().getSchemas().get("Enum_Test");
|
||||
|
||||
@@ -269,5 +266,4 @@ public class TypeScriptFetchModelTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
|
||||
@SuppressWarnings("static-method")
|
||||
public class TypeScriptAngularModelTest {
|
||||
|
||||
@Test(enabled = false, description = "convert a simple TypeScript Angular model")
|
||||
@Test(description = "convert a simple TypeScript Angular model")
|
||||
public void simpleModelTest() {
|
||||
final Schema model = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -82,7 +82,7 @@ public class TypeScriptAngularModelTest {
|
||||
Assert.assertTrue(property4.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with list property", enabled = false)
|
||||
@Test(description = "convert a model with list property")
|
||||
public void listPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -112,12 +112,11 @@ public class TypeScriptAngularModelTest {
|
||||
Assert.assertEquals(property2.datatype, "Array<string>");
|
||||
Assert.assertEquals(property2.name, "urls");
|
||||
Assert.assertEquals(property2.baseType, "Array");
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertFalse(property2.hasMore);
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex property", enabled = false)
|
||||
@Test(description = "convert a model with complex property")
|
||||
public void complexPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -137,10 +136,9 @@ public class TypeScriptAngularModelTest {
|
||||
Assert.assertEquals(property1.defaultValue, "undefined");
|
||||
Assert.assertEquals(property1.baseType, "Children");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex list property", enabled = false)
|
||||
@Test(description = "convert a model with complex list property")
|
||||
public void complexListPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -161,10 +159,9 @@ public class TypeScriptAngularModelTest {
|
||||
Assert.assertEquals(property1.name, "children");
|
||||
Assert.assertEquals(property1.baseType, "Array");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert an array model")
|
||||
@Test(description = "convert an array model")
|
||||
public void arrayModelTest() {
|
||||
final Schema schema = new ArraySchema()
|
||||
.items(new Schema().$ref("#/definitions/Children"))
|
||||
@@ -178,7 +175,7 @@ public class TypeScriptAngularModelTest {
|
||||
Assert.assertEquals(cm.vars.size(), 0);
|
||||
}
|
||||
|
||||
@Test(description = "convert a map model", enabled = false)
|
||||
@Test(description = "convert a map model")
|
||||
public void mapModelTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a map model")
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.testng.annotations.Test;
|
||||
@SuppressWarnings("static-method")
|
||||
public class TypeScriptAngularJsModelTest {
|
||||
|
||||
@Test(enabled = false, description = "convert a simple TypeScript Angular model")
|
||||
@Test(description = "convert a simple TypeScript Angular model")
|
||||
public void simpleModelTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -79,7 +79,7 @@ public class TypeScriptAngularJsModelTest {
|
||||
Assert.assertTrue(property4.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert a model with list property")
|
||||
@Test(description = "convert a model with list property")
|
||||
public void listPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -102,7 +102,6 @@ public class TypeScriptAngularJsModelTest {
|
||||
Assert.assertEquals(property1.baseType, "number");
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
@@ -111,10 +110,9 @@ public class TypeScriptAngularJsModelTest {
|
||||
Assert.assertEquals(property2.baseType, "Array");
|
||||
Assert.assertFalse(property2.hasMore);
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex property", enabled = false)
|
||||
@Test(description = "convert a model with complex property")
|
||||
public void complexPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -134,10 +132,9 @@ public class TypeScriptAngularJsModelTest {
|
||||
Assert.assertEquals(property1.defaultValue, "undefined");
|
||||
Assert.assertEquals(property1.baseType, "models.Children");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex list property", enabled = false)
|
||||
@Test(description = "convert a model with complex list property")
|
||||
public void complexListPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -158,10 +155,9 @@ public class TypeScriptAngularJsModelTest {
|
||||
Assert.assertEquals(property1.name, "children");
|
||||
Assert.assertEquals(property1.baseType, "Array");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert an array model")
|
||||
@Test(description = "convert an array model")
|
||||
public void arrayModelTest() {
|
||||
final Schema schema = new ArraySchema()
|
||||
.items(new Schema().$ref("#/definitions/Children"))
|
||||
@@ -175,7 +171,7 @@ public class TypeScriptAngularJsModelTest {
|
||||
Assert.assertEquals(cm.vars.size(), 0);
|
||||
}
|
||||
|
||||
@Test(description = "convert a map model", enabled = false)
|
||||
@Test(description = "convert a map model")
|
||||
public void mapModelTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a map model")
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.testng.annotations.Test;
|
||||
@SuppressWarnings("static-method")
|
||||
public class TypeScriptNodeModelTest {
|
||||
|
||||
@Test(enabled = false, description = "convert a simple TypeScript Node model")
|
||||
@Test(description = "convert a simple TypeScript Node model")
|
||||
public void simpleModelTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -47,7 +47,6 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property1.baseType, "number");
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "name");
|
||||
@@ -57,7 +56,6 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property2.baseType, "string");
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertTrue(property2.required);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
|
||||
final CodegenProperty property3 = cm.vars.get(2);
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
@@ -67,7 +65,6 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property3.defaultValue, "undefined");
|
||||
Assert.assertTrue(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertTrue(property3.isNotContainer);
|
||||
|
||||
final CodegenProperty property4 = cm.vars.get(3);
|
||||
Assert.assertEquals(property4.baseName, "birthDate");
|
||||
@@ -77,10 +74,9 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property4.defaultValue, "undefined");
|
||||
Assert.assertFalse(property4.hasMore);
|
||||
Assert.assertFalse(property4.required);
|
||||
Assert.assertTrue(property4.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert a model with list property")
|
||||
@Test(description = "convert a model with list property")
|
||||
public void listPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -103,7 +99,6 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property1.baseType, "number");
|
||||
Assert.assertTrue(property1.hasMore);
|
||||
Assert.assertTrue(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
|
||||
final CodegenProperty property2 = cm.vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "urls");
|
||||
@@ -112,10 +107,9 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property2.baseType, "Array");
|
||||
Assert.assertFalse(property2.hasMore);
|
||||
Assert.assertFalse(property2.required);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex property", enabled = false)
|
||||
@Test(description = "convert a model with complex property")
|
||||
public void complexPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -134,10 +128,9 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property1.name, "children");
|
||||
Assert.assertEquals(property1.baseType, "Children");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(description = "convert a model with complex list property", enabled = false)
|
||||
@Test(description = "convert a model with complex list property")
|
||||
public void complexListPropertyTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a sample model")
|
||||
@@ -158,10 +151,9 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(property1.name, "children");
|
||||
Assert.assertEquals(property1.baseType, "Array");
|
||||
Assert.assertFalse(property1.required);
|
||||
Assert.assertTrue(property1.isNotContainer);
|
||||
}
|
||||
|
||||
@Test(enabled = false, description = "convert an array model")
|
||||
@Test(description = "convert an array model")
|
||||
public void arrayModelTest() {
|
||||
final Schema schema = new ArraySchema()
|
||||
.items(new Schema().$ref("#/definitions/Children"))
|
||||
@@ -175,7 +167,7 @@ public class TypeScriptNodeModelTest {
|
||||
Assert.assertEquals(cm.vars.size(), 0);
|
||||
}
|
||||
|
||||
@Test(description = "convert a map model", enabled = false)
|
||||
@Test(description = "convert a map model")
|
||||
public void mapModelTest() {
|
||||
final Schema schema = new Schema()
|
||||
.description("a map model")
|
||||
|
||||
Reference in New Issue
Block a user