Java源码示例:io.swagger.v3.parser.util.SchemaTypeUtil
示例1
private void setCliOption(CliOption cliOption) throws IllegalArgumentException {
if (additionalProperties.containsKey(cliOption.getOpt())) {
// TODO Hack - not sure why the empty strings become boolean.
Object obj = additionalProperties.get(cliOption.getOpt());
if (!SchemaTypeUtil.BOOLEAN_TYPE.equals(cliOption.getType())) {
if (obj instanceof Boolean) {
obj = "";
additionalProperties.put(cliOption.getOpt(), obj);
}
}
cliOption.setOptValue(obj.toString());
} else {
additionalProperties.put(cliOption.getOpt(), cliOption.getOptValue());
}
if (cliOption.getOptValue() == null) {
cliOption.setOptValue(cliOption.getDefault());
throw new IllegalArgumentException(cliOption.getOpt() + ": Invalid value '" + additionalProperties.get(cliOption.getOpt()).toString() + "'" +
". " + cliOption.getDescription());
}
}
示例2
public TypeScriptJqueryClientCodegen() {
super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
modelTemplateFiles.put("model.mustache", ".ts");
apiTemplateFiles.put("api.mustache", ".ts");
typeMapping.put("Date", "Date");
apiPackage = "api";
modelPackage = "model";
outputFolder = "generated-code/typescript-jquery";
embeddedTemplateDir = templateDir = "typescript-jquery";
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(JQUERY_ALREADY_IMPORTED,
"When using this in legacy app using mix of typescript and javascript, this will only declare jquery and not import it",
SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
}
示例3
public TypeScriptReduxQueryClientCodegen() {
super();
// clear import mapping (from default generator) as TS does not use it
// at the moment
importMapping.clear();
supportsMultipleInheritance = true;
outputFolder = "generated-code/typescript-redux-query";
embeddedTemplateDir = templateDir = "typescript-redux-query";
this.apiPackage = "src" + File.separator +"apis";
this.modelPackage = "src" + File.separator + "models";
this.apiTemplateFiles.put("apis.mustache", ".ts");
this.modelTemplateFiles.put("models.mustache", ".ts");
this.addExtraReservedWords();
typeMapping.put("date", "Date");
typeMapping.put("DateTime", "Date");
supportModelPropertyNaming(CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.camelCase);
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
}
示例4
public TypeScriptFetchClientCodegen() {
super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
// clear import mapping (from default generator) as TS does not use it
// at the moment
importMapping.clear();
outputFolder = "generated-code/typescript-fetch";
embeddedTemplateDir = templateDir = "typescript-fetch";
this.apiTemplateFiles.put("apis.mustache", ".ts");
this.modelTemplateFiles.put("models.mustache", ".ts");
this.addExtraReservedWords();
typeMapping.put("date", "Date");
typeMapping.put("DateTime", "Date");
supportModelPropertyNaming(CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.camelCase);
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, CodegenConstants.USE_SINGLE_REQUEST_PARAMETER_DESC, SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
this.cliOptions.add(new CliOption(PREFIX_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(TYPESCRIPT_THREE_PLUS, "Setting this property to true will generate TypeScript 3.6+ compatible code.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
}
示例5
public TypeScriptAxiosClientCodegen() {
super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
// clear import mapping (from default generator) as TS does not use it
// at the moment
importMapping.clear();
outputFolder = "generated-code/typescript-axios";
embeddedTemplateDir = templateDir = "typescript-axios";
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url of your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(SEPARATE_MODELS_AND_API, "Put the model and api in separate folders and in separate classes", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(WITHOUT_PREFIX_ENUMS, "Don't prefix enum names with class names", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
}
示例6
public TypeScriptRxjsClientCodegen() {
super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
outputFolder = "generated-code/typescript-rxjs";
embeddedTemplateDir = templateDir = "typescript-rxjs";
this.apiPackage = "apis";
this.apiTemplateFiles.put("apis.mustache", ".ts");
this.modelPackage = "models";
this.modelTemplateFiles.put("models.mustache", ".ts");
this.addExtraReservedWords();
languageSpecificPrimitives.add("Blob");
typeMapping.put("file", "Blob");
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_PROGRESS_SUBSCRIBER, "Setting this property to true will generate API controller methods with support for subscribing to request progress.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
// these are used in the api template for more efficient destructuring
this.reservedParamNames.add("headers");
this.reservedParamNames.add("query");
this.reservedParamNames.add("formData");
}
示例7
private Schema transformComposedSchema(ComposedSchema swSchema) {
Function<ComposedSchema, List<io.swagger.v3.oas.models.media.Schema>> schemaFunc;
if (CollectionUtils.isNotEmpty(swSchema.getAllOf())) {
schemaFunc = ComposedSchema::getAllOf;
} else if (CollectionUtils.isNotEmpty(swSchema.getOneOf())) {
schemaFunc = ComposedSchema::getOneOf;
} else if (CollectionUtils.isNotEmpty(swSchema.getAnyOf())) {
schemaFunc = ComposedSchema::getAnyOf;
} else {
throw new IllegalStateException("Composed schema is used that is not allOf, oneOf nor anyOf.");
}
List<SchemaAttribute> objectAttributes = schemaFunc.apply(swSchema)
.stream()
.map(this::transformSchema)
.map(Schema::getSchemaAttributes)
.flatMap(Collection::stream)
.collect(toList());
return new Schema.Builder(SchemaTypeUtil.OBJECT_TYPE).schemaAttributes(objectAttributes).build();
}
示例8
public TypeScriptInversifyClientCodegen() {
super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
this.outputFolder = "generated-code/typescript-inversify";
embeddedTemplateDir = templateDir = "typescript-inversify";
modelTemplateFiles.put("model.mustache", ".ts");
apiTemplateFiles.put("api.service.mustache", ".ts");
languageSpecificPrimitives.add("Blob");
typeMapping.put("file", "Blob");
apiPackage = "api";
modelPackage = "model";
this.reservedWords.add("map");
this.cliOptions.add(new CliOption(NPM_REPOSITORY,
"Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES,
"Setting this property to true will generate interfaces next to the default class implementations.",
SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_PROMISE,
"Setting this property to use promise instead of observable inside every service.",
SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_RXJS6,
"Setting this property to use rxjs 6 instead of rxjs 5.",
SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(TAGGED_UNIONS,
"Use discriminators to create tagged unions instead of extending interfaces.",
SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
}
示例9
@Override
public String toDefaultValue(Schema p) {
if (ModelUtils.isBooleanSchema(p)) {
return "bool(false)";
} else if (ModelUtils.isNumberSchema(p)) {
if (SchemaTypeUtil.FLOAT_FORMAT.equals(p.getFormat())) {
return "float(0)";
}
return "double(0)";
} else if (ModelUtils.isIntegerSchema(p)) {
if (SchemaTypeUtil.INTEGER64_FORMAT.equals(p.getFormat())) {
return "long(0)";
}
return "int(0)";
} else if (ModelUtils.isMapSchema(p)) {
return "new std::map()";
} else if (ModelUtils.isArraySchema(p)) {
return "new std::list()";
} else if (!StringUtils.isEmpty(p.get$ref())) {
return "new " + toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()";
} else if (ModelUtils.isDateSchema(p) || ModelUtils.isDateTimeSchema(p)) {
return "null";
} else if (ModelUtils.isStringSchema(p)) {
return "std::string()";
}
return "null";
}
示例10
public static boolean isIntegerSchema(Schema schema) {
if (schema instanceof IntegerSchema) {
return true;
}
if (SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType())) {
return true;
}
return false;
}
示例11
public static boolean isShortSchema(Schema schema) {
if (SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType()) // type: integer
&& SchemaTypeUtil.INTEGER32_FORMAT.equals(schema.getFormat())) { // format: short (int32)
return true;
}
return false;
}
示例12
public static boolean isLongSchema(Schema schema) {
if (SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType()) // type: integer
&& SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) { // format: long (int64)
return true;
}
return false;
}
示例13
public static boolean isBooleanSchema(Schema schema) {
if (schema instanceof BooleanSchema) {
return true;
}
if (SchemaTypeUtil.BOOLEAN_TYPE.equals(schema.getType())) {
return true;
}
return false;
}
示例14
public static boolean isNumberSchema(Schema schema) {
if (schema instanceof NumberSchema) {
return true;
}
if (SchemaTypeUtil.NUMBER_TYPE.equals(schema.getType())) {
return true;
}
return false;
}
示例15
public static boolean isFloatSchema(Schema schema) {
if (SchemaTypeUtil.NUMBER_TYPE.equals(schema.getType())
&& SchemaTypeUtil.FLOAT_FORMAT.equals(schema.getFormat())) { // format: float
return true;
}
return false;
}
示例16
public static boolean isDoubleSchema(Schema schema) {
if (SchemaTypeUtil.NUMBER_TYPE.equals(schema.getType())
&& SchemaTypeUtil.DOUBLE_FORMAT.equals(schema.getFormat())) { // format: double
return true;
}
return false;
}
示例17
public static boolean isDateSchema(Schema schema) {
if (schema instanceof DateSchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.DATE_FORMAT.equals(schema.getFormat())) { // format: date
return true;
}
return false;
}
示例18
public static boolean isDateTimeSchema(Schema schema) {
if (schema instanceof DateTimeSchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.DATE_TIME_FORMAT.equals(schema.getFormat())) { // format: date-time
return true;
}
return false;
}
示例19
public static boolean isPasswordSchema(Schema schema) {
if (schema instanceof PasswordSchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.PASSWORD_FORMAT.equals(schema.getFormat())) { // double
return true;
}
return false;
}
示例20
public static boolean isByteArraySchema(Schema schema) {
if (schema instanceof ByteArraySchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.BYTE_FORMAT.equals(schema.getFormat())) { // format: byte
return true;
}
return false;
}
示例21
public static boolean isBinarySchema(Schema schema) {
if (schema instanceof BinarySchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.BINARY_FORMAT.equals(schema.getFormat())) { // format: binary
return true;
}
return false;
}
示例22
public static boolean isUUIDSchema(Schema schema) {
if (schema instanceof UUIDSchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.UUID_FORMAT.equals(schema.getFormat())) { // format: uuid
return true;
}
return false;
}
示例23
public static boolean isURISchema(Schema schema) {
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& URI_FORMAT.equals(schema.getFormat())) { // format: uri
return true;
}
return false;
}
示例24
public static boolean isEmailSchema(Schema schema) {
if (schema instanceof EmailSchema) {
return true;
}
if (SchemaTypeUtil.STRING_TYPE.equals(schema.getType())
&& SchemaTypeUtil.EMAIL_FORMAT.equals(schema.getFormat())) { // format: email
return true;
}
return false;
}
示例25
@Test
public void arraysInRequestBody() {
OpenAPI openAPI = TestUtils.createOpenAPI();
final JavaClientCodegen codegen = new JavaClientCodegen();
codegen.setOpenAPI(openAPI);
RequestBody body1 = new RequestBody();
body1.setDescription("A list of ids");
body1.setContent(new Content().addMediaType("application/json", new MediaType().schema(new ArraySchema().items(new StringSchema()))));
CodegenParameter codegenParameter1 = codegen.fromRequestBody(body1, new HashSet<String>(), null);
Assert.assertEquals(codegenParameter1.description, "A list of ids");
Assert.assertEquals(codegenParameter1.dataType, "List<String>");
Assert.assertEquals(codegenParameter1.baseType, "String");
RequestBody body2 = new RequestBody();
body2.setDescription("A list of list of values");
body2.setContent(new Content().addMediaType("application/json", new MediaType().schema(new ArraySchema().items(new ArraySchema().items(new IntegerSchema())))));
CodegenParameter codegenParameter2 = codegen.fromRequestBody(body2, new HashSet<String>(), null);
Assert.assertEquals(codegenParameter2.description, "A list of list of values");
Assert.assertEquals(codegenParameter2.dataType, "List<List<Integer>>");
Assert.assertEquals(codegenParameter2.baseType, "List");
RequestBody body3 = new RequestBody();
body3.setDescription("A list of points");
body3.setContent(new Content().addMediaType("application/json", new MediaType().schema(new ArraySchema().items(new ObjectSchema().$ref("#/components/schemas/Point")))));
ObjectSchema point = new ObjectSchema();
point.addProperties("message", new StringSchema());
point.addProperties("x", new IntegerSchema().format(SchemaTypeUtil.INTEGER32_FORMAT));
point.addProperties("y", new IntegerSchema().format(SchemaTypeUtil.INTEGER32_FORMAT));
CodegenParameter codegenParameter3 = codegen.fromRequestBody(body3, new HashSet<String>(), null);
Assert.assertEquals(codegenParameter3.description, "A list of points");
Assert.assertEquals(codegenParameter3.dataType, "List<Point>");
Assert.assertEquals(codegenParameter3.baseType, "Point");
}
示例26
@Test(description = "convert a model with list property")
public void listPropertyTest() {
final Schema schema = new Schema()
.description("a sample model")
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperties("urls", new ArraySchema()
.items(new StringSchema()))
.addRequiredItem("id");
final DefaultCodegen codegen = new JavaClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
codegen.setOpenAPI(openAPI);
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(), 2);
final CodegenProperty property = cm.vars.get(1);
Assert.assertEquals(property.baseName, "urls");
Assert.assertEquals(property.getter, "getUrls");
Assert.assertEquals(property.setter, "setUrls");
Assert.assertEquals(property.dataType, "List<String>");
Assert.assertEquals(property.name, "urls");
Assert.assertEquals(property.defaultValue, "new ArrayList<String>()");
Assert.assertEquals(property.baseType, "List");
Assert.assertEquals(property.containerType, "array");
Assert.assertFalse(property.required);
Assert.assertTrue(property.isContainer);
}
示例27
@Test(description = "convert a model with set property")
public void setPropertyTest() {
final Schema schema = new Schema()
.description("a sample model")
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperties("urls", new ArraySchema()
.items(new StringSchema())
.uniqueItems(true))
.addRequiredItem("id");
final DefaultCodegen codegen = new JavaClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
codegen.setOpenAPI(openAPI);
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(), 2);
final CodegenProperty property = cm.vars.get(1);
Assert.assertEquals(property.baseName, "urls");
Assert.assertEquals(property.getter, "getUrls");
Assert.assertEquals(property.setter, "setUrls");
Assert.assertEquals(property.dataType, "Set<String>");
Assert.assertEquals(property.name, "urls");
Assert.assertEquals(property.defaultValue, "new LinkedHashSet<String>()");
Assert.assertEquals(property.baseType, "Set");
Assert.assertEquals(property.containerType, "set");
Assert.assertFalse(property.required);
Assert.assertTrue(property.isContainer);
}
示例28
@Test(description = "convert a model with list property")
public void listPropertyTest() {
final Schema model = new Schema()
.description("a sample model")
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperties("urls", new ArraySchema()
.items(new StringSchema()))
.addRequiredItem("id");
final DefaultCodegen codegen = new ScalaAkkaClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
//Assert.assertEquals(cm.vars.size(), 2);
final CodegenProperty property1 = cm.vars.get(1);
Assert.assertEquals(property1.baseName, "urls");
Assert.assertEquals(property1.getter, "getUrls");
Assert.assertEquals(property1.setter, "setUrls");
Assert.assertEquals(property1.dataType, "Seq[String]");
Assert.assertEquals(property1.name, "urls");
Assert.assertEquals(property1.defaultValue, "Seq[String].empty ");
Assert.assertEquals(property1.baseType, "Seq");
Assert.assertEquals(property1.containerType, "array");
Assert.assertFalse(property1.required);
Assert.assertTrue(property1.isContainer);
}
示例29
@Test
public void simpleEntityTest() {
final Schema model = new Schema()
.description("a sample model")
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperties("name", new StringSchema())
.addRequiredItem("id")
.addRequiredItem("name");
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
plantumlDocumentationCodegen.setOpenAPI(openAPI);
final CodegenModel cm = plantumlDocumentationCodegen.fromModel("sample", model);
Map<String, Object> objs = createObjectsMapFor(cm);
plantumlDocumentationCodegen.postProcessSupportingFileData(objs);
List<Object> entityList = getList(objs, "entities");
Assert.assertFalse(entityList.isEmpty(), "empty entity list");
Map<String, Object> firstEntity = getEntityFromList("Sample", entityList);
List<Object> fieldList = getList(firstEntity, "fields");
Assert.assertEquals(fieldList.size(), 2, "size of field list");
Map<String, Object> firstField = (Map<String, Object>)fieldList.get(0);
Assert.assertEquals((String)firstField.get("name"), "id");
Assert.assertTrue((boolean)firstField.get("isRequired"));
Assert.assertEquals((String)firstField.get("dataType"), "Long");
}
示例30
@Test(description = "convert a model with list property")
public void listPropertyTest() {
final Schema model = new Schema()
.description("a sample model")
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperties("urls", new ArraySchema()
.items(new StringSchema()))
.addRequiredItem("id");
final DefaultCodegen codegen = new GoClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 2);
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);
final CodegenProperty property2 = cm.vars.get(1);
Assert.assertEquals(property2.baseName, "urls");
Assert.assertEquals(property2.dataType, "[]string");
Assert.assertEquals(property2.name, "Urls");
Assert.assertEquals(property2.baseType, "array");
Assert.assertFalse(property2.hasMore);
Assert.assertEquals(property2.containerType, "array");
Assert.assertFalse(property2.required);
Assert.assertTrue(property2.isPrimitiveType);
}