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

from __future__ import annotations

from typing import Literal, Union

from pydantic import BaseModel, Field, RootModel


class ASchema(BaseModel):
    pass


class BSchema(BaseModel):
    pass


class A1(BaseModel):
    kind: Literal['a']


class B1(BaseModel):
    kind: Literal['b']


class Model(RootModel[Union["A", "B"]]):
    root: Union["A", "B"] = Field(..., discriminator='kind')


class A(RootModel[Union["A2", "A3"]]):
    root: Union["A2", "A3"]


class A2(A1):
    pass


class A3(A1):
    pass


class B(RootModel["B2"]):
    root: "B2"


class B2(B1):
    pass


Model.model_rebuild()
A.model_rebuild()
B.model_rebuild()
