# Buggy code
def parse_any_of(self, name: str, obj: JsonSchemaObject) -> List[DataType]:
    any_of_data_types: List[DataType] = []
    for any_of_item in obj.anyOf:
        if any_of_item.ref:  # $ref
            any_of_data_types.append(
                self.data_type(
                    type=any_of_item.ref_object_name,
                    ref=True,
                    version_compatible=True,
                )
            )
        elif not any(v for k, v in vars(any_of_item).items() if k != "type"):
            # trivial types
            any_of_data_types.append(self.get_data_type(any_of_item))
        elif (
            any_of_item.is_array
            and isinstance(any_of_item.items, JsonSchemaObject)
            and not any(v for k, v in vars(any_of_item.items).items() if k != "type")
        ):
            # trivial item types
            any_of_data_types.append(
                self.data_type(
                    type=f"List[{self.get_data_type(any_of_item.items).type_hint}]",
                    imports_=[Import(from_="typing", import_="List")],
                )
            )
        else:
            singular_name = get_singular_name(name)
            self.parse_object(singular_name, any_of_item)
            any_of_data_types.append(
                self.data_type(type=singular_name, ref=True, version_compatible=True)
            )
    return any_of_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_any_of(self, name: str, obj: JsonSchemaObject) -> List[DataType]:
    any_of_data_types: List[DataType] = []
    for any_of_item in obj.anyOf:
        if any_of_item.ref:  # $ref
            any_of_data_types.append(
                self.data_type(
                    type=any_of_item.ref_object_name,
                    ref=True,
                    version_compatible=True,
                )
            )
        elif not any(v for k, v in vars(any_of_item).items() if k != "type"):
            # trivial types
            any_of_data_types.extend(self.get_data_type(any_of_item))
        elif (
            any_of_item.is_array
            and isinstance(any_of_item.items, JsonSchemaObject)
            and not any(v for k, v in vars(any_of_item.items).items() if k != "type")
        ):
            # trivial item types
            any_of_data_types.append(
                self.data_type(
                    type=f"List[{', '.join([t.type_hint for t in self.get_data_type(any_of_item.items)])}]",
                    imports_=[Import(from_="typing", import_="List")],
                )
            )
        else:
            singular_name = get_singular_name(name)
            self.parse_object(singular_name, any_of_item)
            any_of_data_types.append(
                self.data_type(type=singular_name, ref=True, version_compatible=True)
            )
    return any_of_data_types