# generated by datamodel-codegen:
#   filename:  type_alias_union_default_object_ref_any_of.json
#   timestamp: 2019-07-26T00:00:00+00:00

from __future__ import annotations

from typing import Annotated, Literal

from pydantic import BaseModel, Field, TypeAdapter


class A(BaseModel):
    type: Literal['a'] = 'a'


class B(BaseModel):
    type: Literal['b'] = 'b'


type U = A | B


class Model(BaseModel):
    x_value: Annotated[
        U | None,
        Field(default_factory=lambda: TypeAdapter(U).validate_python({'type': 'b'})),
    ]
