# Buggy code
def parse_array_fields(
    self, name: str, obj: JsonSchemaObject
) -> Tuple[List[DataModelField], List[DataType]]:
    if isinstance(obj.items, JsonSchemaObject):
        items: List[JsonSchemaObject] = [obj.items]
    else:
        items = obj.items  # type: ignore
    item_obj_data_types: List[DataType] = []
    is_union: bool = False
    for item in items:
        if item.ref:
            item_obj_data_types.append(
                self.data_type(
                    type=item.ref_object_name, ref=True, version_compatible=True
                )
            )
        elif isinstance(item, JsonSchemaObject) and item.properties:
            singular_name = get_singular_name(name)
            self.parse_object(singular_name, item)
            item_obj_data_types.append(
                self.data_type(type=singular_name, ref=True, version_compatible=True)
            )
        elif item.anyOf:
            item_obj_data_types.extend(self.parse_any_of(name, item))
            is_union = True
        elif item.allOf:
            singular_name = get_singular_name(name)
            item_obj_data_types.extend(self.parse_all_of(singular_name, item))
        else:
            item_obj_data_types.append(self.get_data_type(item))

    field = self.data_model_field_type(
        data_types=item_obj_data_types,
        example=obj.examples,
        default=obj.default,
        description=obj.default,
        title=obj.title,
        required=True,
        is_list=True,
        is_union=is_union,
    )
    return [field], item_obj_data_types


# Traceback (pydantic.error_wrappers.ValidationError)
Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/base.py", line 164, in parse
self.parse_raw()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/jsonschema.py", line 472, in parse_raw
self.parse_raw_obj(obj_name, raw_obj)
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/jsonschema.py", line 455, in parse_raw_obj
obj = JsonSchemaObject.parse_obj(raw)
File "/proj/.venv/lib/python3.7/site-packages/pydantic/main.py", line 402, in parse_obj
return cls(**obj)
File "/proj/.venv/lib/python3.7/site-packages/pydantic/main.py", line 283, in __init__
raise validation_error
pydantic.error_wrappers.ValidationError: 2 validation errors for JsonSchemaObject
properties -> apiVersion -> type
str type expected (type=type_error.str)
properties -> kind -> type
str type expected (type=type_error.str)

# Fixed code
def parse_array_fields(
    self, name: str, obj: JsonSchemaObject
) -> Tuple[List[DataModelField], List[DataType]]:
    if isinstance(obj.items, JsonSchemaObject):
        items: List[JsonSchemaObject] = [obj.items]
    else:
        items = obj.items  # type: ignore
    item_obj_data_types: List[DataType] = []
    is_union: bool = False
    for item in items:
        if item.ref:
            item_obj_data_types.append(
                self.data_type(
                    type=item.ref_object_name, ref=True, version_compatible=True
                )
            )
        elif isinstance(item, JsonSchemaObject) and item.properties:
            singular_name = get_singular_name(name)
            self.parse_object(singular_name, item)
            item_obj_data_types.append(
                self.data_type(type=singular_name, ref=True, version_compatible=True)
            )
        elif item.anyOf:
            item_obj_data_types.extend(self.parse_any_of(name, item))
            is_union = True
        elif item.allOf:
            singular_name = get_singular_name(name)
            item_obj_data_types.extend(self.parse_all_of(singular_name, item))
        else:
            item_obj_data_types.extend(self.get_data_type(item))

    field = self.data_model_field_type(
        data_types=item_obj_data_types,
        example=obj.examples,
        default=obj.default,
        description=obj.default,
        title=obj.title,
        required=True,
        is_list=True,
        is_union=is_union,
    )
    return [field], item_obj_data_types