Generated by Cython 3.0.11

Yellow lines hint at Python interaction.
Click on a line that starts with a "`+`" to see the C code that Cython generated for it.

Raw output: validation.c

    +001: # cython: language_level=3, embedsignature=True, initializedcheck=False

      __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     002: # Copyright (C) 2018-present Jesus Lara

     003: #

    +004: from typing import get_args, get_origin, Union, Optional, Literal

      __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_get_args);
      __Pyx_GIVEREF(__pyx_n_s_get_args);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_args)) __PYX_ERR(0, 4, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_get_origin);
      __Pyx_GIVEREF(__pyx_n_s_get_origin);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_get_origin)) __PYX_ERR(0, 4, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_Union);
      __Pyx_GIVEREF(__pyx_n_s_Union);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Union)) __PYX_ERR(0, 4, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_Optional);
      __Pyx_GIVEREF(__pyx_n_s_Optional);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_Optional)) __PYX_ERR(0, 4, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_Literal);
      __Pyx_GIVEREF(__pyx_n_s_Literal);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_Literal)) __PYX_ERR(0, 4, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_get_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_args, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_origin, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Optional); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Literal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Literal, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +005: from collections.abc import Callable, Awaitable

      __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_Callable);
      __Pyx_GIVEREF(__pyx_n_s_Callable);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Callable)) __PYX_ERR(0, 5, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_Awaitable);
      __Pyx_GIVEREF(__pyx_n_s_Awaitable);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_Awaitable)) __PYX_ERR(0, 5, __pyx_L1_error);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Callable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Callable, __pyx_t_3) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Awaitable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Awaitable, __pyx_t_3) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +006: import typing

      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_typing, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_typing, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +007: import asyncio

      __pyx_t_2 = __Pyx_patch_asyncio(__Pyx_ImportDottedModule(__pyx_n_s_asyncio, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +008: import inspect

      __pyx_t_2 = __Pyx_patch_inspect(__Pyx_ImportDottedModule(__pyx_n_s_inspect, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_inspect, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     009: from cpython.object cimport PyObject_IsInstance, PyObject_IsSubclass

     010: from cpython.type cimport PyType_Check

    +011: from enum import Enum

      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_Enum);
      __Pyx_GIVEREF(__pyx_n_s_Enum);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Enum)) __PYX_ERR(0, 11, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +012: from decimal import Decimal

      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_Decimal);
      __Pyx_GIVEREF(__pyx_n_s_Decimal);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Decimal)) __PYX_ERR(0, 12, __pyx_L1_error);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_decimal, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Decimal, __pyx_t_3) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +013: import datetime

      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_datetime, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +014: from uuid import UUID

      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_UUID);
      __Pyx_GIVEREF(__pyx_n_s_UUID);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_UUID)) __PYX_ERR(0, 14, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_uuid, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_UUID); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_UUID, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +015: import asyncpg.pgproto.pgproto as pgproto

      __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_asyncpg_pgproto_pgproto, __pyx_tuple__19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgproto, __pyx_t_3) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /* … */
      __pyx_tuple__19 = PyTuple_Pack(3, __pyx_n_s_asyncpg, __pyx_n_s_pgproto, __pyx_n_s_pgproto); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__19);
      __Pyx_GIVEREF(__pyx_tuple__19);

    +016: from .types import uint64_min, uint64_max, Text

      __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_uint64_min);
      __Pyx_GIVEREF(__pyx_n_s_uint64_min);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_uint64_min)) __PYX_ERR(0, 16, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_uint64_max);
      __Pyx_GIVEREF(__pyx_n_s_uint64_max);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_uint64_max)) __PYX_ERR(0, 16, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_Text);
      __Pyx_GIVEREF(__pyx_n_s_Text);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_Text)) __PYX_ERR(0, 16, __pyx_L1_error);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_types, __pyx_t_3, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint64_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint64_min, __pyx_t_3) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint64_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint64_max, __pyx_t_3) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Text, __pyx_t_3) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +017: from .fields import Field

      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_Field_2);
      __Pyx_GIVEREF(__pyx_n_s_Field_2);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Field_2)) __PYX_ERR(0, 17, __pyx_L1_error);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_fields, __pyx_t_2, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Field_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_Field_2, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +018: from .functions import (

      __pyx_t_2 = __Pyx_Import(__pyx_n_s_functions, __pyx_t_3, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_iterable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_iterable, __pyx_t_3) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_primitive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_primitive, __pyx_t_3) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_dataclass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_dataclass, __pyx_t_3) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_function); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_function, __pyx_t_3) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_callable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_callable, __pyx_t_3) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_empty, __pyx_t_3) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +019:     is_iterable,

      __pyx_t_3 = PyList_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_n_s_is_iterable);
      __Pyx_GIVEREF(__pyx_n_s_is_iterable);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_is_iterable)) __PYX_ERR(0, 19, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_is_primitive);
      __Pyx_GIVEREF(__pyx_n_s_is_primitive);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_is_primitive)) __PYX_ERR(0, 19, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_is_dataclass);
      __Pyx_GIVEREF(__pyx_n_s_is_dataclass);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_is_dataclass)) __PYX_ERR(0, 19, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_is_function);
      __Pyx_GIVEREF(__pyx_n_s_is_function);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_is_function)) __PYX_ERR(0, 19, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_is_callable);
      __Pyx_GIVEREF(__pyx_n_s_is_callable);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_is_callable)) __PYX_ERR(0, 19, __pyx_L1_error);
      __Pyx_INCREF(__pyx_n_s_is_empty);
      __Pyx_GIVEREF(__pyx_n_s_is_empty);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_is_empty)) __PYX_ERR(0, 19, __pyx_L1_error);

     020:     is_primitive,

     021:     is_dataclass,

     022:     is_function,

     023:     is_callable,

     024:     is_empty

     025: )

     026:

     027:

    +028: cdef str valid_int(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_int(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     029:     # Basic check for integer type.

    +030:     if not isinstance(value, int):

      __pyx_t_1 = PyInt_Check(__pyx_v_value);
      __pyx_t_2 = (!__pyx_t_1);
      if (__pyx_t_2) {
    /* … */
      }

    +031:         return f"Field {name} expected an integer, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_4 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Field);
        __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_an_integer_got);
        __pyx_t_4 += 26;
        __Pyx_GIVEREF(__pyx_kp_u_expected_an_integer_got);
        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_expected_an_integer_got);
        __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_4 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_of_type);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +032:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     033:

    +034: cdef str valid_float(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_float(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +035:     if not isinstance(value, (float, int)):  # sometimes ints are allowed

      __pyx_t_2 = PyFloat_Check(__pyx_v_value);
      if (!__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = PyInt_Check(__pyx_v_value);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L4_bool_binop_done:;
      __pyx_t_2 = (!__pyx_t_1);
      if (__pyx_t_2) {
    /* … */
      }

    +036:         return f"Field {name} expected a float, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_4 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Field);
        __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_float_got);
        __pyx_t_4 += 23;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_float_got);
        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_expected_a_float_got);
        __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_4 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_of_type);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +037:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     038:

    +039: cdef str valid_str(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_str(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +040:     if not isinstance(value, str):

      __pyx_t_1 = PyUnicode_Check(__pyx_v_value);
      __pyx_t_2 = (!__pyx_t_1);
      if (__pyx_t_2) {
    /* … */
      }

    +041:         return f"Field {name} expected a string, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_4 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Field);
        __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_string_got);
        __pyx_t_4 += 24;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_string_got);
        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_expected_a_string_got);
        __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_4 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_of_type);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +042:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     043:

    +044: cdef str valid_uuid(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_uuid(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("datamodel.validation.valid_uuid", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +045:     if not isinstance(value, (UUID, pgproto.UUID)):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_UUID); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pgproto); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UUID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1);
      if (!__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_5 = PyObject_IsInstance(__pyx_v_value, __pyx_t_3);
      __pyx_t_4 = __pyx_t_5;
      __pyx_L4_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = (!__pyx_t_4);
      if (__pyx_t_5) {
    /* … */
      }

    +046:         return f"Field {name} expected a UUID, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = 0;
        __pyx_t_7 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_6 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Field);
        __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
        __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_UUID_got);
        __pyx_t_6 += 22;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_UUID_got);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_expected_a_UUID_got);
        __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
        __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_6 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_of_type);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_7;
        __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L0;

    +047:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     048:

    +049: cdef str valid_boolean(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_boolean(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_boolean", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +050:     if not isinstance(value, bool):

      __pyx_t_1 = ((PyObject*)&PyBool_Type);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 50, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = (!__pyx_t_2);
      if (__pyx_t_3) {
    /* … */
      }

    +051:         return f"Field {name} expected a boolean, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = 0;
        __pyx_t_5 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_4 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Field);
        __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_boolean_got);
        __pyx_t_4 += 25;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_boolean_got);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_expected_a_boolean_got);
        __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_4 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_of_type);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +052:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     053:

    +054: cdef str valid_date(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_date(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_date", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +055:     if not isinstance(value, datetime.date):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (!__pyx_t_3);
      if (__pyx_t_4) {
    /* … */
      }

    +056:         return f"Field {name} expected a date, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = 0;
        __pyx_t_6 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_5 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Field);
        __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_date_got);
        __pyx_t_5 += 22;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_date_got);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_expected_a_date_got);
        __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_5 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_of_type);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 6, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +057:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     058:

    +059: cdef str valid_datetime(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_datetime(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_AddTraceback("datamodel.validation.valid_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +060:     if isinstance(value, datetime.datetime):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_3) {
    /* … */
      }

    +061:         return None

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
        goto __pyx_L0;

    +062:     if isinstance(value, datetime.date):

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {
    /* … */
      }

    +063:         return None

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
        goto __pyx_L0;

    +064:     return f"Field {name} expected a datetime, got {value!r} of type {type(value).__name__}"

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_Field);
      __pyx_t_4 += 6;
      __Pyx_GIVEREF(__pyx_kp_u_Field);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Field);
      __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_expected_a_datetime_got);
      __pyx_t_4 += 26;
      __Pyx_GIVEREF(__pyx_kp_u_expected_a_datetime_got);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_expected_a_datetime_got);
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_of_type);
      __pyx_t_4 += 9;
      __Pyx_GIVEREF(__pyx_kp_u_of_type);
      PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_of_type);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;

     065:

    +066: cdef str valid_timedelta(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_timedelta(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_timedelta", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +067:     if not isinstance(value, datetime.timedelta):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (!__pyx_t_3);
      if (__pyx_t_4) {
    /* … */
      }

    +068:         return f"Field {name} expected a timedelta, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = 0;
        __pyx_t_6 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_5 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Field);
        __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_timedelta_got);
        __pyx_t_5 += 27;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_timedelta_got);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_expected_a_timedelta_got);
        __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_5 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_of_type);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 6, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +069:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     070:

    +071: cdef str valid_time(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_time(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +072:     if not isinstance(value, datetime.time):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (!__pyx_t_3);
      if (__pyx_t_4) {
    /* … */
      }

    +073:         return f"Field {name} expected a time, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = 0;
        __pyx_t_6 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_5 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Field);
        __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_time_got);
        __pyx_t_5 += 22;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_time_got);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_expected_a_time_got);
        __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_5 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_of_type);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
        __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 6, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +074:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     075:

    +076: cdef str valid_decimal(object field, str name, object value, object _type):

    static PyObject *__pyx_f_9datamodel_10validation_valid_decimal(CYTHON_UNUSED PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v__type) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("datamodel.validation.valid_decimal", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +077:     if not isinstance(value, Decimal):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 77, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = (!__pyx_t_2);
      if (__pyx_t_3) {
    /* … */
      }

    +078:         return f"Field {name} expected a Decimal, got {value!r} of type {type(value).__name__}"

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = 0;
        __pyx_t_5 = 127;
        __Pyx_INCREF(__pyx_kp_u_Field);
        __pyx_t_4 += 6;
        __Pyx_GIVEREF(__pyx_kp_u_Field);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Field);
        __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_Decimal_got);
        __pyx_t_4 += 25;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_Decimal_got);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_expected_a_Decimal_got);
        __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_of_type);
        __pyx_t_4 += 9;
        __Pyx_GIVEREF(__pyx_kp_u_of_type);
        PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_of_type);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L0;

    +079:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     080:

     081:

     082: # List of Validators (primitive types):

     083: validators = {

    +084:     str: valid_str,

      __pyx_t_2 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyUnicode_Type)), __pyx_t_3) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +085:     int: valid_int,

      __pyx_t_3 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_int); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyInt_Type)), __pyx_t_3) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +086:     float: valid_float,

      __pyx_t_3 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_float); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyFloat_Type)), __pyx_t_3) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +087:     UUID: valid_uuid,

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_UUID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_uuid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +088:     pgproto.UUID: valid_uuid,

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pgproto); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_UUID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_uuid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +089:     bool: valid_boolean,

      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_boolean); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, ((PyObject*)&PyBool_Type), __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +090:     datetime.date: valid_date,

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_date); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +091:     datetime.datetime: valid_datetime,

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +092:     datetime.timedelta: valid_timedelta,

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_timedelta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +093:     datetime.time: valid_time,

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +094:     Decimal: valid_decimal,

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_decimal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +095:     Text: valid_str

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_CFunc_ed5399__9datamodel_10validation_unicode__lParenobject___etc_to_py_5field_4name_5value_5_type(__pyx_f_9datamodel_10validation_valid_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_validators, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     096: }

     097:

    +098: cdef dict _create_error(str name, object value, object error, object val_type, object annotated_type, object exception = None):

    static PyObject *__pyx_f_9datamodel_10validation__create_error(PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_error, PyObject *__pyx_v_val_type, PyObject *__pyx_v_annotated_type, struct __pyx_opt_args_9datamodel_10validation__create_error *__pyx_optional_args) {
      PyObject *__pyx_v_exception = ((PyObject *)Py_None);
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_exception = __pyx_optional_args->exception;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("datamodel.validation._create_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_9datamodel_10validation__create_error {
      int __pyx_n;
      PyObject *exception;
    };

    +099:     return {

      __Pyx_XDECREF(__pyx_r);

    +100:         "field": name,

      __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_field, __pyx_v_name) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

    +101:         "value": value,

      if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_value, __pyx_v_value) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

    +102:         "error": error,

      if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_error, __pyx_v_error) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

    +103:         "value_type": val_type,

      if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_value_type, __pyx_v_val_type) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

    +104:         "annotation": annotated_type,

      if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_annotation, __pyx_v_annotated_type) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

    +105:         "exception": exception

      if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_exception, __pyx_v_exception) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

     106:     }

     107:

     108:

    +109: cdef inline bint is_enum_class(object annotated_type):

    static CYTHON_INLINE int __pyx_f_9datamodel_10validation_is_enum_class(PyObject *__pyx_v_annotated_type) {
      int __pyx_v_res;
      int __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("datamodel.validation.is_enum_class", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    static PyObject *__pyx_gb_9datamodel_10validation_13is_instanceof_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

     110:     cdef int res

     111:     # First, check if annotated_type is a type

    +112:     if not PyType_Check(annotated_type):

      __pyx_t_1 = (!PyType_Check(__pyx_v_annotated_type));
      if (__pyx_t_1) {
    /* … */
      }

    +113:         return False

        __pyx_r = 0;
        goto __pyx_L0;

     114:     # Then check if it is a subclass of Enum.

    +115:     res = PyObject_IsSubclass(annotated_type, <object>Enum)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_IsSubclass(__pyx_v_annotated_type, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_res = __pyx_t_1;

    +116:     if res < 0:

      __pyx_t_1 = (__pyx_v_res < 0);
      if (unlikely(__pyx_t_1)) {
    /* … */
      }

     117:         # If an error occurred, you might want to raise an exception.

    +118:         raise RuntimeError("Error in PyObject_IsSubclass")

        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 118, __pyx_L1_error)
    /* … */
      __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Error_in_PyObject_IsSubclass); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__3);
      __Pyx_GIVEREF(__pyx_tuple__3);

    +119:     return res != 0

      __pyx_r = (__pyx_v_res != 0);
      goto __pyx_L0;

     120:

    +121: cdef bint is_instanceof(object value, type annotated_type):

    static int __pyx_f_9datamodel_10validation_is_instanceof(PyObject *__pyx_v_value, PyTypeObject *__pyx_v_annotated_type) {
      struct __pyx_obj_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof *__pyx_cur_scope;
      PyObject *__pyx_v_origin = NULL;
      PyObject *__pyx_v_args = NULL;
      PyObject *__pyx_v_container_map = NULL;
      PyObject *__pyx_v_e = NULL;
      PyObject *__pyx_gb_9datamodel_10validation_13is_instanceof_2generator = 0;
      int __pyx_r;
      __pyx_cur_scope = (struct __pyx_obj_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof *)__pyx_tp_new_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof(__pyx_ptype_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof, __pyx_empty_tuple, NULL);
      if (unlikely(!__pyx_cur_scope)) {
        __pyx_cur_scope = ((struct __pyx_obj_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof *)Py_None);
        __Pyx_INCREF(Py_None);
        __PYX_ERR(0, 121, __pyx_L1_error)
      } else {
        __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
      }
      __pyx_cur_scope->__pyx_v_value = __pyx_v_value;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_AddTraceback("datamodel.validation.is_instanceof", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_origin);
      __Pyx_XDECREF(__pyx_v_args);
      __Pyx_XDECREF(__pyx_v_container_map);
      __Pyx_XDECREF(__pyx_v_e);
      __Pyx_XDECREF(__pyx_gb_9datamodel_10validation_13is_instanceof_2generator);
      __Pyx_DECREF((PyObject *)__pyx_cur_scope);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_obj_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof {
      PyObject_HEAD
      PyObject *__pyx_v_value;
    };

     122:     """

     123:     Check if value is an instance of annotated_type, handling typing objects properly.

     124:     For generic types (List[int], etc.), just check against the base container type.

     125:     """

     126:     # Get origin type for generics

    +127:     origin = get_origin(annotated_type)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_annotated_type)};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_origin = __pyx_t_1;
      __pyx_t_1 = 0;

     128:

     129:     # If it's a typing module type like List[int], Dict[str, int], etc.

    +130:     if annotated_type.__module__ == 'typing':

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_annotated_type), __pyx_n_s_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_typing, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 130, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {
    /* … */
      }

     131:         # For Union, check each option

    +132:         if origin is Union:

        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = (__pyx_v_origin == __pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_5) {
    /* … */
        }

    +133:             args = get_args(annotated_type)

          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = NULL;
          __pyx_t_4 = 0;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
              __pyx_t_4 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_annotated_type)};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
          __pyx_v_args = __pyx_t_1;
          __pyx_t_1 = 0;

    +134:             return any(is_instanceof(value, arg) for arg in args if arg is not type(None)) or value is None and type(None) in args

    static PyObject *__pyx_pf_9datamodel_10validation_13is_instanceof_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
      struct __pyx_obj_9datamodel_10validation___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
      PyObject *__pyx_r = NULL;
      __pyx_cur_scope = (struct __pyx_obj_9datamodel_10validation___pyx_scope_struct_1_genexpr *)__pyx_tp_new_9datamodel_10validation___pyx_scope_struct_1_genexpr(__pyx_ptype_9datamodel_10validation___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
      if (unlikely(!__pyx_cur_scope)) {
        __pyx_cur_scope = ((struct __pyx_obj_9datamodel_10validation___pyx_scope_struct_1_genexpr *)Py_None);
        __Pyx_INCREF(Py_None);
        __PYX_ERR(0, 134, __pyx_L1_error)
      } else {
        __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
      }
      __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof *) __pyx_self;
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
      __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
      __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
      {
        __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9datamodel_10validation_13is_instanceof_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_is_instanceof_locals_genexpr, __pyx_n_s_datamodel_validation); if (unlikely(!gen)) __PYX_ERR(0, 134, __pyx_L1_error)
        __Pyx_DECREF(__pyx_cur_scope);
        __Pyx_RefNannyFinishContext();
        return (PyObject *) gen;
      }

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_AddTraceback("datamodel.validation.is_instanceof.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __Pyx_DECREF((PyObject *)__pyx_cur_scope);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_gb_9datamodel_10validation_13is_instanceof_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
    {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("genexpr", 0);
      __pyx_L3_first_run:;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 134, __pyx_L1_error)
      if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 134, __pyx_L1_error) }
      if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
        __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_3 = NULL;
      } else {
        __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_3)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          }
        } else {
          __pyx_t_4 = __pyx_t_3(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 134, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_arg);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_arg, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_5 = (__pyx_cur_scope->__pyx_v_arg != ((PyObject *)Py_TYPE(Py_None)));
        if (__pyx_t_5) {
          if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); __PYX_ERR(0, 134, __pyx_L1_error) }
          __pyx_t_4 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_value;
          __Pyx_INCREF(__pyx_t_4);
          if (!(likely(PyType_CheckExact(__pyx_cur_scope->__pyx_v_arg))||((__pyx_cur_scope->__pyx_v_arg) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_cur_scope->__pyx_v_arg))) __PYX_ERR(0, 134, __pyx_L1_error)
          __pyx_t_5 = __pyx_f_9datamodel_10validation_is_instanceof(__pyx_t_4, ((PyTypeObject*)__pyx_cur_scope->__pyx_v_arg)); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_5) {
            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(Py_True);
            __pyx_r = Py_True;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;
      }
      CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_Generator_Replace_StopIteration(0);
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      #if !CYTHON_USE_EXC_INFO_STACK
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      #endif
      __pyx_generator->resume_label = -1;
      __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
          __pyx_t_1 = __pyx_pf_9datamodel_10validation_13is_instanceof_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!__pyx_t_6) {
          } else {
            __pyx_t_5 = __pyx_t_6;
            goto __pyx_L5_bool_binop_done;
          }
          __pyx_t_6 = (__pyx_cur_scope->__pyx_v_value == Py_None);
          if (__pyx_t_6) {
          } else {
            __pyx_t_5 = __pyx_t_6;
            goto __pyx_L5_bool_binop_done;
          }
          __pyx_t_6 = (__Pyx_PySequence_ContainsTF(((PyObject *)Py_TYPE(Py_None)), __pyx_v_args, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
          __pyx_t_5 = __pyx_t_6;
          __pyx_L5_bool_binop_done:;
          __pyx_r = __pyx_t_5;
          goto __pyx_L0;
    /* … */
    struct __pyx_obj_9datamodel_10validation___pyx_scope_struct_1_genexpr {
      PyObject_HEAD
      struct __pyx_obj_9datamodel_10validation___pyx_scope_struct____pyx_f_9datamodel_10validation_is_instanceof *__pyx_outer_scope;
      PyObject *__pyx_genexpr_arg_0;
      PyObject *__pyx_v_arg;
    };

     135:

     136:         # For container types, check against base type

    +137:         elif origin in (list, tuple, set, frozenset, dict):

        __Pyx_INCREF(__pyx_v_origin);
        __pyx_t_2 = __pyx_v_origin;
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (!__pyx_t_6) {
        } else {
          __pyx_t_5 = __pyx_t_6;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PyTuple_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (!__pyx_t_6) {
        } else {
          __pyx_t_5 = __pyx_t_6;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PySet_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (!__pyx_t_6) {
        } else {
          __pyx_t_5 = __pyx_t_6;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PyFrozenSet_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (!__pyx_t_6) {
        } else {
          __pyx_t_5 = __pyx_t_6;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PyDict_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = __pyx_t_6;
        __pyx_L8_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = __pyx_t_5;
        if (__pyx_t_6) {
    /* … */
        }

     138:             container_map = {

    +139:                 list: list,

          __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyList_Type)), ((PyObject *)(&PyList_Type))) < 0) __PYX_ERR(0, 139, __pyx_L1_error)

    +140:                 tuple: tuple,

          if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyTuple_Type)), ((PyObject *)(&PyTuple_Type))) < 0) __PYX_ERR(0, 139, __pyx_L1_error)

    +141:                 set: set,

          if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PySet_Type)), ((PyObject *)(&PySet_Type))) < 0) __PYX_ERR(0, 139, __pyx_L1_error)

    +142:                 frozenset: frozenset,

          if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyFrozenSet_Type)), ((PyObject *)(&PyFrozenSet_Type))) < 0) __PYX_ERR(0, 139, __pyx_L1_error)

    +143:                 dict: dict

          if (PyDict_SetItem(__pyx_t_2, ((PyObject *)(&PyDict_Type)), ((PyObject *)(&PyDict_Type))) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
          __pyx_v_container_map = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;

     144:             }

    +145:             return isinstance(value, container_map.get(origin, object))

          __pyx_t_2 = __pyx_cur_scope->__pyx_v_value;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_container_map, __pyx_v_origin, __pyx_builtin_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 145, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_r = __pyx_t_6;
          goto __pyx_L0;

     146:

     147:         # For other typing constructs, consider it valid (can be refined further)

    +148:         return True

        __pyx_r = 1;
        goto __pyx_L0;

     149:

     150:     # For datetime types, use issubclass check

    +151:     elif value in (datetime.date, datetime.time, datetime.datetime):

      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
      __pyx_t_1 = __pyx_cur_scope->__pyx_v_value;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!__pyx_t_5) {
      } else {
        __pyx_t_6 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!__pyx_t_5) {
      } else {
        __pyx_t_6 = __pyx_t_5;
        goto __pyx_L13_bool_binop_done;
      }
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __pyx_t_5;
      __pyx_L13_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __pyx_t_6;
      if (__pyx_t_5) {
    /* … */
      }

     152:         # Check if is a pendulum instance:

    +153:         return issubclass(value, (datetime.date, datetime.time, datetime.datetime))

        __pyx_t_1 = __pyx_cur_scope->__pyx_v_value;
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_7);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_8);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8)) __PYX_ERR(0, 153, __pyx_L1_error);
        __pyx_t_3 = 0;
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_5 = PyObject_IsSubclass(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 153, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        goto __pyx_L0;

     154:

     155:     # For normal types, use isinstance

     156:     else:

    +157:         try:

      /*else*/ {
        {
          /*try:*/ {
    /* … */
          }
          __pyx_L20_try_return:;
          goto __pyx_L0;
        }
      }

    +158:             return isinstance(value, annotated_type)

            __pyx_t_2 = __pyx_cur_scope->__pyx_v_value;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_2, __pyx_v_annotated_type);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_r = __pyx_t_5;
            goto __pyx_L20_try_return;

     159:         except (AttributeError, TypeError, ValueError) as e:

     160:             # For errors with subscripted generics, just return True

     161:             if "subscripted generics" in str(e):

     162:                 return True

     163:             raise TypeError(f"{e}")

     164:

    +165: cpdef bint is_optional_type(object annotated_type):

    static PyObject *__pyx_pw_9datamodel_10validation_1is_optional_type(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static int __pyx_f_9datamodel_10validation_is_optional_type(PyObject *__pyx_v_annotated_type, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_v_origin = NULL;
      PyObject *__pyx_v_args = NULL;
      int __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("datamodel.validation.is_optional_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_origin);
      __Pyx_XDECREF(__pyx_v_args);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_9datamodel_10validation_1is_optional_type(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_9datamodel_10validation_is_optional_type, "is_optional_type(annotated_type) -> bool\n\n    Check if annotated_type is an Optional type (Union[T, None]).\n    ");
    static PyMethodDef __pyx_mdef_9datamodel_10validation_1is_optional_type = {"is_optional_type", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_10validation_1is_optional_type, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_10validation_is_optional_type};
    static PyObject *__pyx_pw_9datamodel_10validation_1is_optional_type(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_annotated_type = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("is_optional_type (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_MACROS
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_annotated_type,0};
      PyObject* values[1] = {0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_annotated_type)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_optional_type") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        }
        __pyx_v_annotated_type = values[0];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("is_optional_type", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 165, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      {
        Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
          __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
        }
      }
      __Pyx_AddTraceback("datamodel.validation.is_optional_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_9datamodel_10validation_is_optional_type(__pyx_self, __pyx_v_annotated_type);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      {
        Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
          __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
        }
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_9datamodel_10validation_is_optional_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_annotated_type) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_9datamodel_10validation_is_optional_type(__pyx_v_annotated_type, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("datamodel.validation.is_optional_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_annotated_type); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__20);
      __Pyx_GIVEREF(__pyx_tuple__20);
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9datamodel_10validation_1is_optional_type, 0, __pyx_n_s_is_optional_type, NULL, __pyx_n_s_datamodel_validation, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_optional_type, __pyx_t_2) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_validation_pyx, __pyx_n_s_is_optional_type, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 165, __pyx_L1_error)

     166:     """

     167:     Check if annotated_type is an Optional type (Union[T, None]).

     168:     """

    +169:     origin = get_origin(annotated_type)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_annotated_type};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_origin = __pyx_t_1;
      __pyx_t_1 = 0;

     170:

     171:     # If it's a Union, check if None is one of the options

    +172:     if origin is Union:

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = (__pyx_v_origin == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {
    /* … */
      }

    +173:         args = get_args(annotated_type)

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = NULL;
        __pyx_t_4 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_4 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_annotated_type};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_v_args = __pyx_t_1;
        __pyx_t_1 = 0;

    +174:         return type(None) in args

        __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)Py_TYPE(Py_None)), __pyx_v_args, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 174, __pyx_L1_error)
        __pyx_r = __pyx_t_5;
        goto __pyx_L0;

     175:

     176:     # For backward compatibility with Python 3.8

     177:     # Check old-style Optional typing

    +178:     if hasattr(annotated_type, "__origin__") and annotated_type.__origin__ is Union:

      __pyx_t_6 = __Pyx_HasAttr(__pyx_v_annotated_type, __pyx_n_u_origin); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 178, __pyx_L1_error)
      if (__pyx_t_6) {
      } else {
        __pyx_t_5 = __pyx_t_6;
        goto __pyx_L5_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_annotated_type, __pyx_n_s_origin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = (__pyx_t_1 == __pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __pyx_t_6;
      __pyx_L5_bool_binop_done:;
      if (__pyx_t_5) {
    /* … */
      }

    +179:         args = annotated_type.__args__

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_annotated_type, __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_args = __pyx_t_2;
        __pyx_t_2 = 0;

    +180:         return type(None) in args

        __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)Py_TYPE(Py_None)), __pyx_v_args, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 180, __pyx_L1_error)
        __pyx_r = __pyx_t_5;
        goto __pyx_L0;

     181:

    +182:     return False

      __pyx_r = 0;
      goto __pyx_L0;

     183:

    +184: cdef object get_primary_key_field(object annotated_type, str name, object field_meta):

    static PyObject *__pyx_f_9datamodel_10validation_get_primary_key_field(PyObject *__pyx_v_annotated_type, PyObject *__pyx_v_name, PyObject *__pyx_v_field_meta) {
      PyObject *__pyx_v_f = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_AddTraceback("datamodel.validation.get_primary_key_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_f);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +185:     for f in annotated_type.__dataclass_fields__.values():

      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_annotated_type, __pyx_n_s_dataclass_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__pyx_t_5 == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
        __PYX_ERR(0, 185, __pyx_L1_error)
      }
      __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_6;
      __pyx_t_6 = 0;
      while (1) {
        __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_6, NULL, __pyx_t_4);
        if (unlikely(__pyx_t_7 == 0)) break;
        if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_6);
        __pyx_t_6 = 0;

    +186:         if name == f.name:

        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_t_6, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 186, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_8) {
    /* … */
        }

    +187:             return f

          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_f);
          __pyx_r = __pyx_v_f;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L0;

    +188:         if field_meta.get('alias') == f.name:

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_field_meta, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = NULL;
        __pyx_t_10 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_10 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_n_u_alias};
          __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 188, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 188, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_8) {
    /* … */
        }

    +189:             return f

          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_f);
          __pyx_r = __pyx_v_f;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L0;

    +190:         if f.metadata.get('primary_key', False):

        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 190, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_8) {
    /* … */
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /* … */
      __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_u_primary_key, Py_False); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__4);
      __Pyx_GIVEREF(__pyx_tuple__4);

    +191:             return f

          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_f);
          __pyx_r = __pyx_v_f;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L0;

    +192:     return None

      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

     193:

    +194: cdef dict _validate_union_field(

    static PyObject *__pyx_f_9datamodel_10validation__validate_union_field(PyObject *__pyx_v_F, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_annotated_type) {
      CYTHON_UNUSED PyObject *__pyx_v_origin = 0;
      PyObject *__pyx_v_targs = 0;
      PyObject *__pyx_v_subtype_origin = 0;
      PyObject *__pyx_v_errors = 0;
      PyObject *__pyx_v_sub_error = 0;
      PyObject *__pyx_v_list_args = 0;
      PyObject *__pyx_v_inner_type = 0;
      PyObject *__pyx_v_item_errors = 0;
      PyObject *__pyx_v_dict_args = 0;
      PyObject *__pyx_v_key_type = 0;
      PyObject *__pyx_v_val_type = 0;
      PyObject *__pyx_v_subtype = NULL;
      PyObject *__pyx_v_idx = NULL;
      PyObject *__pyx_v_item = NULL;
      PyObject *__pyx_v_dict_errors = NULL;
      PyObject *__pyx_v_k = NULL;
      PyObject *__pyx_v_v = NULL;
      PyObject *__pyx_v_exc = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_17);
      __Pyx_AddTraceback("datamodel.validation._validate_union_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_origin);
      __Pyx_XDECREF(__pyx_v_targs);
      __Pyx_XDECREF(__pyx_v_subtype_origin);
      __Pyx_XDECREF(__pyx_v_errors);
      __Pyx_XDECREF(__pyx_v_sub_error);
      __Pyx_XDECREF(__pyx_v_list_args);
      __Pyx_XDECREF(__pyx_v_inner_type);
      __Pyx_XDECREF(__pyx_v_item_errors);
      __Pyx_XDECREF(__pyx_v_dict_args);
      __Pyx_XDECREF(__pyx_v_key_type);
      __Pyx_XDECREF(__pyx_v_val_type);
      __Pyx_XDECREF(__pyx_v_subtype);
      __Pyx_XDECREF(__pyx_v_idx);
      __Pyx_XDECREF(__pyx_v_item);
      __Pyx_XDECREF(__pyx_v_dict_errors);
      __Pyx_XDECREF(__pyx_v_k);
      __Pyx_XDECREF(__pyx_v_v);
      __Pyx_XDECREF(__pyx_v_exc);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     195:     object F,           # Field object (your internal representation)

     196:     str name,           # Field name

     197:     object value,       # Actual runtime value

     198:     object annotated_type  # The declared type (e.g. Union[str, List[str]], etc.)

     199: ):

     200:     """

     201:     Validates a complex or nested Union (including Optional and nested structures)

     202:     Returns {} if validation passes, or a dict describing the error.

     203:     """

    +204:     cdef object origin = get_origin(annotated_type)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_annotated_type};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_origin = __pyx_t_1;
      __pyx_t_1 = 0;

    +205:     cdef tuple targs = get_args(annotated_type)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_annotated_type};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 205, __pyx_L1_error)
      __pyx_v_targs = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +206:     cdef object subtype_origin = None

      __Pyx_INCREF(Py_None);
      __pyx_v_subtype_origin = Py_None;

    +207:     cdef list errors = []

      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_errors = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     208:     cdef dict sub_error

    +209:     cdef tuple list_args = ()

      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_v_list_args = __pyx_empty_tuple;

    +210:     cdef object inner_type = None

      __Pyx_INCREF(Py_None);
      __pyx_v_inner_type = Py_None;

    +211:     cdef list item_errors = []

      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_item_errors = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +212:     cdef tuple dict_args = ()

      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_v_dict_args = __pyx_empty_tuple;

    +213:     cdef object key_type = None

      __Pyx_INCREF(Py_None);
      __pyx_v_key_type = Py_None;

    +214:     cdef object val_type = None

      __Pyx_INCREF(Py_None);
      __pyx_v_val_type = Py_None;

     215:

     216:     # 1) Handle Optional (Union[..., None]) if present

    +217:     if type(None) in targs and value is None:

      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(((PyObject *)Py_TYPE(Py_None)), __pyx_v_targs, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 217, __pyx_L1_error)
      if (__pyx_t_6) {
      } else {
        __pyx_t_5 = __pyx_t_6;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_6 = (__pyx_v_value == Py_None);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_5) {
    /* … */
      }

    +218:         return {}  # Valid because it's None

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L0;

     219:

     220:     # 2) Try each subtype in the Union

    +221:     for subtype in targs:

      if (unlikely(__pyx_v_targs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 221, __pyx_L1_error)
      }
      __pyx_t_1 = __pyx_v_targs; __Pyx_INCREF(__pyx_t_1);
      __pyx_t_7 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 221, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 221, __pyx_L1_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_subtype, __pyx_t_2);
        __pyx_t_2 = 0;
    /* … */
        __pyx_L6_continue:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     222:         # Skip NoneType if it isn't our value

    +223:         if subtype is type(None):

        __pyx_t_5 = (__pyx_v_subtype == ((PyObject *)Py_TYPE(Py_None)));
        if (__pyx_t_5) {
    /* … */
        }

    +224:             continue

          goto __pyx_L6_continue;

     225:

    +226:         subtype_origin = get_origin(subtype)

        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = NULL;
        __pyx_t_4 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_4 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_subtype};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_subtype_origin, __pyx_t_2);
        __pyx_t_2 = 0;

     227:

    +228:         try:

        {
          /*try:*/ {
    /* … */
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L16_try_end;
          __pyx_L9_error:;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    /* … */
          __pyx_L11_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L13_try_return:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L0;
          __pyx_L10_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          __pyx_L16_try_end:;
        }

     229:             # 2a) If there's no origin, it's a simple or direct type (str, int, custom class, etc.)

    +230:             if subtype_origin is None:

            __pyx_t_5 = (__pyx_v_subtype_origin == Py_None);
            if (__pyx_t_5) {
    /* … */
              goto __pyx_L17;
            }

     231:                 # If it's just a normal type, check with isinstance

    +232:                 if isinstance(value, subtype):

              __pyx_t_5 = PyObject_IsInstance(__pyx_v_value, __pyx_v_subtype); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 232, __pyx_L9_error)
              if (__pyx_t_5) {
    /* … */
              }

     233:                     # PASS: we found a valid subtype

    +234:                     return {}

                __Pyx_XDECREF(__pyx_r);
                __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_r = ((PyObject*)__pyx_t_2);
                __pyx_t_2 = 0;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                goto __pyx_L13_try_return;

     235:                 # Not matching? We'll record an error & continue

    +236:                 errors.append(f"Value is not instance of {subtype}")

              __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_subtype, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_is_not_instance_of, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 236, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     237:

     238:             # 2b) If it's a nested Union, validate recursively

    +239:             elif subtype_origin is Union:

            __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = (__pyx_v_subtype_origin == __pyx_t_3);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (__pyx_t_5) {
    /* … */
              goto __pyx_L17;
            }

    +240:                 sub_error = _validate_union_field(F, name, value, subtype)

              __pyx_t_3 = __pyx_f_9datamodel_10validation__validate_union_field(__pyx_v_F, __pyx_v_name, __pyx_v_value, __pyx_v_subtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_XDECREF_SET(__pyx_v_sub_error, ((PyObject*)__pyx_t_3));
              __pyx_t_3 = 0;

    +241:                 if not sub_error:

              __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_sub_error); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 241, __pyx_L9_error)
              __pyx_t_6 = (!__pyx_t_5);
              if (__pyx_t_6) {
    /* … */
              }

    +242:                     return {}  # success

                __Pyx_XDECREF(__pyx_r);
                __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_r = ((PyObject*)__pyx_t_3);
                __pyx_t_3 = 0;
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                goto __pyx_L13_try_return;

    +243:                 errors.append(f"Nested union check failed for {subtype}: {sub_error}")

              __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_13 = 0;
              __pyx_t_14 = 127;
              __Pyx_INCREF(__pyx_kp_u_Nested_union_check_failed_for);
              __pyx_t_13 += 30;
              __Pyx_GIVEREF(__pyx_kp_u_Nested_union_check_failed_for);
              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Nested_union_check_failed_for);
              __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_subtype, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
              __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
              __pyx_t_2 = 0;
              __Pyx_INCREF(__pyx_kp_u__5);
              __pyx_t_13 += 2;
              __Pyx_GIVEREF(__pyx_kp_u__5);
              PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__5);
              __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_sub_error, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
              __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
              __pyx_t_2 = 0;
              __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_2); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 243, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     244:

     245:             # 2c) If it's a list origin, e.g. List[str]

    +246:             elif subtype_origin is list:

            __pyx_t_6 = (__pyx_v_subtype_origin == ((PyObject *)(&PyList_Type)));
            if (__pyx_t_6) {
    /* … */
              goto __pyx_L17;
            }

    +247:                 list_args = get_args(subtype)

              __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_8 = NULL;
              __pyx_t_4 = 0;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_3))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_3, function);
                  __pyx_t_4 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_subtype};
                __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
                __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              }
              if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 247, __pyx_L9_error)
              __Pyx_DECREF_SET(__pyx_v_list_args, ((PyObject*)__pyx_t_2));
              __pyx_t_2 = 0;

    +248:                 if not isinstance(value, list):

              __pyx_t_6 = PyList_Check(__pyx_v_value);
              __pyx_t_5 = (!__pyx_t_6);
              if (__pyx_t_5) {
    /* … */
                goto __pyx_L20;
              }

    +249:                     errors.append(f"Expected list, got {type(value).__name__}")

                __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Expected_list_got, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_2); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 249, __pyx_L9_error)
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     250:                 else:

     251:                     # Validate each item if you like (e.g. ensure each item is str)

    +252:                     inner_type = list_args[0]

              /*else*/ {
                if (unlikely(__pyx_v_list_args == Py_None)) {
                  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                  __PYX_ERR(0, 252, __pyx_L9_error)
                }
                __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_list_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF_SET(__pyx_v_inner_type, __pyx_t_2);
                __pyx_t_2 = 0;

    +253:                     item_errors = []

                __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF_SET(__pyx_v_item_errors, ((PyObject*)__pyx_t_2));
                __pyx_t_2 = 0;

    +254:                     for idx, item in enumerate(value):

                __Pyx_INCREF(__pyx_int_0);
                __pyx_t_2 = __pyx_int_0;
                if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) {
                  __pyx_t_3 = __pyx_v_value; __Pyx_INCREF(__pyx_t_3);
                  __pyx_t_13 = 0;
                  __pyx_t_15 = NULL;
                } else {
                  __pyx_t_13 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 254, __pyx_L9_error)
                }
                for (;;) {
                  if (likely(!__pyx_t_15)) {
                    if (likely(PyList_CheckExact(__pyx_t_3))) {
                      {
                        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                        #if !CYTHON_ASSUME_SAFE_MACROS
                        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 254, __pyx_L9_error)
                        #endif
                        if (__pyx_t_13 >= __pyx_temp) break;
                      }
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 254, __pyx_L9_error)
                      #else
                      __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_8);
                      #endif
                    } else {
                      {
                        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
                        #if !CYTHON_ASSUME_SAFE_MACROS
                        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 254, __pyx_L9_error)
                        #endif
                        if (__pyx_t_13 >= __pyx_temp) break;
                      }
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 254, __pyx_L9_error)
                      #else
                      __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_8);
                      #endif
                    }
                  } else {
                    __pyx_t_8 = __pyx_t_15(__pyx_t_3);
                    if (unlikely(!__pyx_t_8)) {
                      PyObject* exc_type = PyErr_Occurred();
                      if (exc_type) {
                        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                        else __PYX_ERR(0, 254, __pyx_L9_error)
                      }
                      break;
                    }
                    __Pyx_GOTREF(__pyx_t_8);
                  }
                  __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
                  __pyx_t_8 = 0;
                  __Pyx_INCREF(__pyx_t_2);
                  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_2);
                  __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_8);
                  __Pyx_DECREF(__pyx_t_2);
                  __pyx_t_2 = __pyx_t_8;
                  __pyx_t_8 = 0;
    /* … */
                }
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     255:                         # For simple inner type

    +256:                         if get_origin(inner_type) is None:

                  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 256, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_16);
                  __pyx_t_17 = NULL;
                  __pyx_t_4 = 0;
                  #if CYTHON_UNPACK_METHODS
                  if (unlikely(PyMethod_Check(__pyx_t_16))) {
                    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
                    if (likely(__pyx_t_17)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
                      __Pyx_INCREF(__pyx_t_17);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_16, function);
                      __pyx_t_4 = 1;
                    }
                  }
                  #endif
                  {
                    PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_v_inner_type};
                    __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
                    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 256, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_8);
                    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                  }
                  __pyx_t_5 = (__pyx_t_8 == Py_None);
                  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                  if (__pyx_t_5) {
    /* … */
                    goto __pyx_L23;
                  }

    +257:                             if not isinstance(item, inner_type):

                    __pyx_t_5 = PyObject_IsInstance(__pyx_v_item, __pyx_v_inner_type); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L9_error)
                    __pyx_t_6 = (!__pyx_t_5);
                    if (__pyx_t_6) {
    /* … */
                    }

    +258:                                 item_errors.append(f"Index {idx}: {type(item).__name__} != {inner_type}")

                      __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_8);
                      __pyx_t_18 = 0;
                      __pyx_t_14 = 127;
                      __Pyx_INCREF(__pyx_kp_u_Index);
                      __pyx_t_18 += 6;
                      __Pyx_GIVEREF(__pyx_kp_u_Index);
                      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Index);
                      __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_v_idx, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_16);
                      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) : __pyx_t_14;
                      __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16);
                      __Pyx_GIVEREF(__pyx_t_16);
                      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_16);
                      __pyx_t_16 = 0;
                      __Pyx_INCREF(__pyx_kp_u__5);
                      __pyx_t_18 += 2;
                      __Pyx_GIVEREF(__pyx_kp_u__5);
                      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__5);
                      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_16);
                      __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_t_16, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_17);
                      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_14;
                      __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                      __Pyx_GIVEREF(__pyx_t_17);
                      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_17);
                      __pyx_t_17 = 0;
                      __Pyx_INCREF(__pyx_kp_u__6);
                      __pyx_t_18 += 4;
                      __Pyx_GIVEREF(__pyx_kp_u__6);
                      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u__6);
                      __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_v_inner_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_17);
                      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_14;
                      __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                      __Pyx_GIVEREF(__pyx_t_17);
                      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_17);
                      __pyx_t_17 = 0;
                      __pyx_t_17 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_18, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_17);
                      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_item_errors, __pyx_t_17); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 258, __pyx_L9_error)
                      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

     259:                         else:

     260:                             # Possibly nested structure again

    +261:                             sub_error = _validate_union_field(F, f"{name}[{idx}]", item, inner_type)

                  /*else*/ {
                    __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 261, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __pyx_t_18 = 0;
                    __pyx_t_14 = 127;
                    __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 261, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_8);
                    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_14;
                    __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
                    __Pyx_GIVEREF(__pyx_t_8);
                    PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_8);
                    __pyx_t_8 = 0;
                    __Pyx_INCREF(__pyx_kp_u__7);
                    __pyx_t_18 += 1;
                    __Pyx_GIVEREF(__pyx_kp_u__7);
                    PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_kp_u__7);
                    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_idx, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 261, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_8);
                    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_14;
                    __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
                    __Pyx_GIVEREF(__pyx_t_8);
                    PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_8);
                    __pyx_t_8 = 0;
                    __Pyx_INCREF(__pyx_kp_u__8);
                    __pyx_t_18 += 1;
                    __Pyx_GIVEREF(__pyx_kp_u__8);
                    PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_kp_u__8);
                    __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_17, 4, __pyx_t_18, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 261, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_8);
                    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                    __pyx_t_17 = __pyx_f_9datamodel_10validation__validate_union_field(__pyx_v_F, ((PyObject*)__pyx_t_8), __pyx_v_item, __pyx_v_inner_type); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 261, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                    __Pyx_XDECREF_SET(__pyx_v_sub_error, ((PyObject*)__pyx_t_17));
                    __pyx_t_17 = 0;

    +262:                             if sub_error:

                    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_sub_error); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 262, __pyx_L9_error)
                    if (__pyx_t_6) {
    /* … */
                    }
                  }
                  __pyx_L23:;

    +263:                                 item_errors.append(str(sub_error))

                      __pyx_t_17 = __Pyx_PyObject_Unicode(__pyx_v_sub_error); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 263, __pyx_L9_error)
                      __Pyx_GOTREF(__pyx_t_17);
                      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_item_errors, __pyx_t_17); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 263, __pyx_L9_error)
                      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

    +264:                     if not item_errors:

                __pyx_t_6 = (PyList_GET_SIZE(__pyx_v_item_errors) != 0);
                __pyx_t_5 = (!__pyx_t_6);
                if (__pyx_t_5) {
    /* … */
                }

    +265:                         return {}  # All items validated

                  __Pyx_XDECREF(__pyx_r);
                  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  __pyx_r = ((PyObject*)__pyx_t_2);
                  __pyx_t_2 = 0;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  goto __pyx_L13_try_return;

    +266:                     errors.append(f"List item errors: {item_errors}")

                __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_item_errors, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_List_item_errors, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 266, __pyx_L9_error)
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              }
              __pyx_L20:;

     267:

     268:             # 2d) If it's a dict origin, e.g. Dict[str, int] or Dict[str, Union[int, ...]]

    +269:             elif subtype_origin is dict:

            __pyx_t_5 = (__pyx_v_subtype_origin == ((PyObject *)(&PyDict_Type)));
            if (__pyx_t_5) {
    /* … */
              goto __pyx_L17;
            }

    +270:                 dict_args = get_args(subtype)  # (key_type, value_type)

              __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_17 = NULL;
              __pyx_t_4 = 0;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_2))) {
                __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_2);
                if (likely(__pyx_t_17)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
                  __Pyx_INCREF(__pyx_t_17);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_2, function);
                  __pyx_t_4 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_v_subtype};
                __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
                __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              }
              if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_3))) __PYX_ERR(0, 270, __pyx_L9_error)
              __Pyx_DECREF_SET(__pyx_v_dict_args, ((PyObject*)__pyx_t_3));
              __pyx_t_3 = 0;

    +271:                 key_type = dict_args[0]

              if (unlikely(__pyx_v_dict_args == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                __PYX_ERR(0, 271, __pyx_L9_error)
              }
              __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_dict_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF_SET(__pyx_v_key_type, __pyx_t_3);
              __pyx_t_3 = 0;

    +272:                 val_type = dict_args[1]

              if (unlikely(__pyx_v_dict_args == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                __PYX_ERR(0, 272, __pyx_L9_error)
              }
              __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_dict_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF_SET(__pyx_v_val_type, __pyx_t_3);
              __pyx_t_3 = 0;

    +273:                 if not isinstance(value, dict):

              __pyx_t_5 = PyDict_Check(__pyx_v_value);
              __pyx_t_6 = (!__pyx_t_5);
              if (__pyx_t_6) {
    /* … */
                goto __pyx_L28;
              }

    +274:                     errors.append(f"Expected dict, got {type(value).__name__}")

                __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Expected_dict_got, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 274, __pyx_L9_error)
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     275:                 else:

    +276:                     dict_errors = []

              /*else*/ {
                __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_XDECREF_SET(__pyx_v_dict_errors, ((PyObject*)__pyx_t_3));
                __pyx_t_3 = 0;

     277:                     # Validate each key, value

    +278:                     for k, v in value.items():

                __pyx_t_13 = 0;
                if (unlikely(__pyx_v_value == Py_None)) {
                  PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
                  __PYX_ERR(0, 278, __pyx_L9_error)
                }
                __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_value, 0, __pyx_n_s_items, (&__pyx_t_18), (&__pyx_t_19)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_XDECREF(__pyx_t_3);
                __pyx_t_3 = __pyx_t_2;
                __pyx_t_2 = 0;
                while (1) {
                  __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_18, &__pyx_t_13, &__pyx_t_2, &__pyx_t_17, NULL, __pyx_t_19);
                  if (unlikely(__pyx_t_20 == 0)) break;
                  if (unlikely(__pyx_t_20 == -1)) __PYX_ERR(0, 278, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  __Pyx_GOTREF(__pyx_t_17);
                  __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2);
                  __pyx_t_2 = 0;
                  __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_17);
                  __pyx_t_17 = 0;

     279:                         # Check key

    +280:                         if not isinstance(k, key_type):

                  __pyx_t_6 = PyObject_IsInstance(__pyx_v_k, __pyx_v_key_type); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 280, __pyx_L9_error)
                  __pyx_t_5 = (!__pyx_t_6);
                  if (__pyx_t_5) {
    /* … */
                  }

    +281:                             dict_errors.append(f"Key {k!r} type mismatch; expected {key_type}")

                    __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 281, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __pyx_t_21 = 0;
                    __pyx_t_14 = 127;
                    __Pyx_INCREF(__pyx_kp_u_Key);
                    __pyx_t_21 += 4;
                    __Pyx_GIVEREF(__pyx_kp_u_Key);
                    PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_kp_u_Key);
                    __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_k), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_2);
                    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
                    __pyx_t_21 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
                    __Pyx_GIVEREF(__pyx_t_2);
                    PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_2);
                    __pyx_t_2 = 0;
                    __Pyx_INCREF(__pyx_kp_u_type_mismatch_expected);
                    __pyx_t_21 += 25;
                    __Pyx_GIVEREF(__pyx_kp_u_type_mismatch_expected);
                    PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_kp_u_type_mismatch_expected);
                    __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_key_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_2);
                    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
                    __pyx_t_21 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
                    __Pyx_GIVEREF(__pyx_t_2);
                    PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_2);
                    __pyx_t_2 = 0;
                    __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_17, 4, __pyx_t_21, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_2);
                    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_dict_errors, __pyx_t_2); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 281, __pyx_L9_error)
                    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     282:                         # Then check value

    +283:                         sub_error = _validate_union_field(F, f'{name}[\"{k}\"]', v, val_type)

                  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  __pyx_t_21 = 0;
                  __pyx_t_14 = 127;
                  __pyx_t_17 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 283, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_14;
                  __pyx_t_21 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                  __Pyx_GIVEREF(__pyx_t_17);
                  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_17);
                  __pyx_t_17 = 0;
                  __Pyx_INCREF(__pyx_kp_u__9);
                  __pyx_t_21 += 2;
                  __Pyx_GIVEREF(__pyx_kp_u__9);
                  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u__9);
                  __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 283, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_14;
                  __pyx_t_21 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                  __Pyx_GIVEREF(__pyx_t_17);
                  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_17);
                  __pyx_t_17 = 0;
                  __Pyx_INCREF(__pyx_kp_u__10);
                  __pyx_t_21 += 2;
                  __Pyx_GIVEREF(__pyx_kp_u__10);
                  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u__10);
                  __pyx_t_17 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_21, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 283, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                  __pyx_t_2 = __pyx_f_9datamodel_10validation__validate_union_field(__pyx_v_F, ((PyObject*)__pyx_t_17), __pyx_v_v, __pyx_v_val_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                  __Pyx_XDECREF_SET(__pyx_v_sub_error, ((PyObject*)__pyx_t_2));
                  __pyx_t_2 = 0;

    +284:                         if sub_error:

                  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_sub_error); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 284, __pyx_L9_error)
                  if (__pyx_t_5) {
    /* … */
                  }
                }
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +285:                             dict_errors.append(f"For key={k}: {sub_error}")

                    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_2);
                    __pyx_t_21 = 0;
                    __pyx_t_14 = 127;
                    __Pyx_INCREF(__pyx_kp_u_For_key);
                    __pyx_t_21 += 8;
                    __Pyx_GIVEREF(__pyx_kp_u_For_key);
                    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_For_key);
                    __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 285, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_14;
                    __pyx_t_21 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                    __Pyx_GIVEREF(__pyx_t_17);
                    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_17);
                    __pyx_t_17 = 0;
                    __Pyx_INCREF(__pyx_kp_u__5);
                    __pyx_t_21 += 2;
                    __Pyx_GIVEREF(__pyx_kp_u__5);
                    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__5);
                    __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_v_sub_error, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 285, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_14;
                    __pyx_t_21 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                    __Pyx_GIVEREF(__pyx_t_17);
                    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_17);
                    __pyx_t_17 = 0;
                    __pyx_t_17 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_21, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 285, __pyx_L9_error)
                    __Pyx_GOTREF(__pyx_t_17);
                    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_dict_errors, __pyx_t_17); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 285, __pyx_L9_error)
                    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

    +286:                     if not dict_errors:

                __pyx_t_5 = (PyList_GET_SIZE(__pyx_v_dict_errors) != 0);
                __pyx_t_6 = (!__pyx_t_5);
                if (__pyx_t_6) {
    /* … */
                }

    +287:                         return {}  # success

                  __Pyx_XDECREF(__pyx_r);
                  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __pyx_r = ((PyObject*)__pyx_t_3);
                  __pyx_t_3 = 0;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  goto __pyx_L13_try_return;

    +288:                     errors.append(f"Dict item errors: {dict_errors}")

                __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_dict_errors, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_17 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Dict_item_errors, __pyx_t_3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 288, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_17); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 288, __pyx_L9_error)
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              }
              __pyx_L28:;

     289:

     290:             else:

     291:                 # If you have other complex type origins (tuple, etc.), handle them similarly

    +292:                 errors.append(f"Unhandled type origin: {subtype_origin} for subtype={subtype}")

            /*else*/ {
              __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 292, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_17);
              __pyx_t_18 = 0;
              __pyx_t_14 = 127;
              __Pyx_INCREF(__pyx_kp_u_Unhandled_type_origin);
              __pyx_t_18 += 23;
              __Pyx_GIVEREF(__pyx_kp_u_Unhandled_type_origin);
              PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_kp_u_Unhandled_type_origin);
              __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_subtype_origin, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_14;
              __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_3);
              __pyx_t_3 = 0;
              __Pyx_INCREF(__pyx_kp_u_for_subtype);
              __pyx_t_18 += 13;
              __Pyx_GIVEREF(__pyx_kp_u_for_subtype);
              PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_kp_u_for_subtype);
              __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_subtype, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_14;
              __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_17, 4, __pyx_t_18, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
              __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 292, __pyx_L9_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_L17:;

     293:

    +294:         except Exception as exc:

          __pyx_t_19 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
          if (__pyx_t_19) {
            __Pyx_AddTraceback("datamodel.validation._validate_union_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_17, &__pyx_t_2) < 0) __PYX_ERR(0, 294, __pyx_L11_except_error)
            __Pyx_XGOTREF(__pyx_t_3);
            __Pyx_XGOTREF(__pyx_t_17);
            __Pyx_XGOTREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_17);
            __pyx_v_exc = __pyx_t_17;
            /*try:*/ {
    /* … */
            /*finally:*/ {
              /*normal exit:*/{
                __Pyx_DECREF(__pyx_v_exc); __pyx_v_exc = 0;
                goto __pyx_L40;
              }
              __pyx_L39_error:;
              /*exception exit:*/{
                __Pyx_PyThreadState_declare
                __Pyx_PyThreadState_assign
                __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
                __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_26, &__pyx_t_27, &__pyx_t_28);
                if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
                __Pyx_XGOTREF(__pyx_t_23);
                __Pyx_XGOTREF(__pyx_t_24);
                __Pyx_XGOTREF(__pyx_t_25);
                __Pyx_XGOTREF(__pyx_t_26);
                __Pyx_XGOTREF(__pyx_t_27);
                __Pyx_XGOTREF(__pyx_t_28);
                __pyx_t_19 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
                {
                  __Pyx_DECREF(__pyx_v_exc); __pyx_v_exc = 0;
                }
                if (PY_MAJOR_VERSION >= 3) {
                  __Pyx_XGIVEREF(__pyx_t_26);
                  __Pyx_XGIVEREF(__pyx_t_27);
                  __Pyx_XGIVEREF(__pyx_t_28);
                  __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_27, __pyx_t_28);
                }
                __Pyx_XGIVEREF(__pyx_t_23);
                __Pyx_XGIVEREF(__pyx_t_24);
                __Pyx_XGIVEREF(__pyx_t_25);
                __Pyx_ErrRestore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
                __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
                __pyx_lineno = __pyx_t_19; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_22;
                goto __pyx_L11_except_error;
              }
              __pyx_L40:;
            }
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            goto __pyx_L10_exception_handled;
          }
          goto __pyx_L11_except_error;

    +295:             errors.append(f"Exception in subtype {subtype}: {exc}")

              __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L39_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_18 = 0;
              __pyx_t_14 = 127;
              __Pyx_INCREF(__pyx_kp_u_Exception_in_subtype);
              __pyx_t_18 += 21;
              __Pyx_GIVEREF(__pyx_kp_u_Exception_in_subtype);
              PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Exception_in_subtype);
              __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_v_subtype, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L39_error)
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) : __pyx_t_14;
              __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16);
              __Pyx_GIVEREF(__pyx_t_16);
              PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_16);
              __pyx_t_16 = 0;
              __Pyx_INCREF(__pyx_kp_u__5);
              __pyx_t_18 += 2;
              __Pyx_GIVEREF(__pyx_kp_u__5);
              PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__5);
              __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_v_exc, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L39_error)
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) : __pyx_t_14;
              __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16);
              __Pyx_GIVEREF(__pyx_t_16);
              PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_16);
              __pyx_t_16 = 0;
              __pyx_t_16 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, __pyx_t_18, __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L39_error)
              __Pyx_GOTREF(__pyx_t_16);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_errors, __pyx_t_16); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L39_error)
              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            }

     296:

     297:     # 3) If no subtype matched, create an error record

    +298:     return _create_error(

      __Pyx_XDECREF(__pyx_r);
    /* … */
      __pyx_t_29.__pyx_n = 1;
      __pyx_t_29.exception = __pyx_v_errors;
      __pyx_t_1 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_annotated_type, &__pyx_t_29); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

     299:         name,

     300:         value,

    +301:         f"Invalid type for {annotated_type}.{name}, expected one of {targs}",

      __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = 0;
      __pyx_t_14 = 127;
      __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
      __pyx_t_7 += 17;
      __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_type_for);
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
      __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u__11);
      __pyx_t_7 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__11);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__11);
      __pyx_t_2 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
      __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_expected_one_of);
      __pyx_t_7 += 18;
      __Pyx_GIVEREF(__pyx_kp_u_expected_one_of);
      PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_expected_one_of);
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_targs, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_14;
      __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_7, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     302:         type(value),

     303:         annotated_type,

     304:         errors

     305:     )

     306:

    +307: cdef dict _validate_constraints(

    static PyObject *__pyx_f_9datamodel_10validation__validate_constraints(PyObject *__pyx_v_field, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_annotated_type, PyObject *__pyx_v_val_type) {
      PyObject *__pyx_v_length = 0;
      PyObject *__pyx_v_min_length = 0;
      PyObject *__pyx_v_max_length = 0;
      PyObject *__pyx_v_min_val = 0;
      PyObject *__pyx_v_max_val = 0;
      PyObject *__pyx_v_ge_val = 0;
      PyObject *__pyx_v_le_val = 0;
      PyObject *__pyx_v_eq_val = 0;
      PyObject *__pyx_v_ne_val = 0;
      PyObject *__pyx_v_pattern = 0;
      PyObject *__pyx_v_metadata = NULL;
      CYTHON_UNUSED PyObject *__pyx_v_error = NULL;
      PyObject *__pyx_v_re = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("datamodel.validation._validate_constraints", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_length);
      __Pyx_XDECREF(__pyx_v_min_length);
      __Pyx_XDECREF(__pyx_v_max_length);
      __Pyx_XDECREF(__pyx_v_min_val);
      __Pyx_XDECREF(__pyx_v_max_val);
      __Pyx_XDECREF(__pyx_v_ge_val);
      __Pyx_XDECREF(__pyx_v_le_val);
      __Pyx_XDECREF(__pyx_v_eq_val);
      __Pyx_XDECREF(__pyx_v_ne_val);
      __Pyx_XDECREF(__pyx_v_pattern);
      __Pyx_XDECREF(__pyx_v_metadata);
      __Pyx_XDECREF(__pyx_v_error);
      __Pyx_XDECREF(__pyx_v_re);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     308:     object field,

     309:     str name,

     310:     object value,

     311:     object annotated_type,

     312:     object val_type

     313: ):

     314:     """

     315:     Validates primitive field constraints based on field metadata.

     316:

     317:     Handles the following validations:

     318:     - For strings: length, min_length, max_length

     319:     - For numbers: min, max, gt, lt, ge, le, eq

     320:

     321:     Args:

     322:         field: The Field object

     323:         name: Field name

     324:         value: The value to validate

     325:         annotated_type: The annotated type

     326:         val_type: The actual value type

     327:

     328:     Returns:

     329:         Empty dict if validation passes, error dict otherwise

     330:     """

     331:     # string comparisons

    +332:     cdef object length = None

      __Pyx_INCREF(Py_None);
      __pyx_v_length = Py_None;

    +333:     cdef object min_length = None

      __Pyx_INCREF(Py_None);
      __pyx_v_min_length = Py_None;

    +334:     cdef object max_length = None

      __Pyx_INCREF(Py_None);
      __pyx_v_max_length = Py_None;

     335:     # integer/float comparisons

    +336:     cdef object min_val = None

      __Pyx_INCREF(Py_None);
      __pyx_v_min_val = Py_None;

    +337:     cdef object max_val = None

      __Pyx_INCREF(Py_None);
      __pyx_v_max_val = Py_None;

    +338:     cdef object ge_val = None

      __Pyx_INCREF(Py_None);
      __pyx_v_ge_val = Py_None;

    +339:     cdef object le_val = None

      __Pyx_INCREF(Py_None);
      __pyx_v_le_val = Py_None;

    +340:     cdef object eq_val = None

      __Pyx_INCREF(Py_None);
      __pyx_v_eq_val = Py_None;

    +341:     cdef object ne_val = None

      __Pyx_INCREF(Py_None);
      __pyx_v_ne_val = Py_None;

    +342:     cdef object pattern = None

      __Pyx_INCREF(Py_None);
      __pyx_v_pattern = Py_None;

     343:     # Skip validation if value is None

    +344:     if value is None:

      __pyx_t_1 = (__pyx_v_value == Py_None);
      if (__pyx_t_1) {
    /* … */
      }

    +345:         return {}

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L0;

     346:

    +347:     metadata = field.metadata

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_metadata = __pyx_t_2;
      __pyx_t_2 = 0;

    +348:     error = {}

      __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_error = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

     349:

     350:     # String validations

    +351:     if annotated_type is str:

      __pyx_t_1 = (__pyx_v_annotated_type == ((PyObject *)(&PyUnicode_Type)));
      if (__pyx_t_1) {
    /* … */
        goto __pyx_L4;
      }

    +352:         length = metadata.get('length', None)

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_length, __pyx_t_3);
        __pyx_t_3 = 0;
    /* … */
      __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_u_length, Py_None); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);

    +353:         min_length = metadata.get('min_length', None)

        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_min_length, __pyx_t_2);
        __pyx_t_2 = 0;
    /* … */
      __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_u_min_length, Py_None); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__13);
      __Pyx_GIVEREF(__pyx_tuple__13);

    +354:         max_length = metadata.get('max_length', None)

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_max_length, __pyx_t_3);
        __pyx_t_3 = 0;
    /* … */
      __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_u_max_length, Py_None); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__14);
      __Pyx_GIVEREF(__pyx_tuple__14);

    +355:         pattern = metadata.get('pattern', getattr(field, '_pattern', None))

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_pattern_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_6 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_n_u_pattern, __pyx_t_4};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_pattern, __pyx_t_3);
        __pyx_t_3 = 0;

     356:         # Length validation

    +357:         if length is not None and len(value) != length:

        __pyx_t_7 = (__pyx_v_length != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L6_bool_binop_done;
        }
        __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 357, __pyx_L1_error)
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_length, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 357, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L6_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +358:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_3, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     359:                 name,

     360:                 value,

    +361:                 f"String length must be exactly {length} characters, got {len(value)}",

          __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = 0;
          __pyx_t_9 = 127;
          __Pyx_INCREF(__pyx_kp_u_String_length_must_be_exactly);
          __pyx_t_8 += 30;
          __Pyx_GIVEREF(__pyx_kp_u_String_length_must_be_exactly);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_String_length_must_be_exactly);
          __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_length, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_9;
          __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
          __pyx_t_3 = 0;
          __Pyx_INCREF(__pyx_kp_u_characters_got);
          __pyx_t_8 += 17;
          __Pyx_GIVEREF(__pyx_kp_u_characters_got);
          PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_characters_got);
          __pyx_t_10 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 361, __pyx_L1_error)
          __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_10, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     362:                 val_type,

     363:                 annotated_type

     364:             )

     365:

     366:         # Min length validation

    +367:         if min_length is not None and len(value) < min_length:

        __pyx_t_7 = (__pyx_v_min_length != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L9_bool_binop_done;
        }
        __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 367, __pyx_L1_error)
        __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_min_length, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L9_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +368:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_3 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_2, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_r = ((PyObject*)__pyx_t_3);
          __pyx_t_3 = 0;
          goto __pyx_L0;

     369:                 name,

     370:                 value,

    +371:                 f"String length must be at least {min_length} characters, got {len(value)}",

          __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = 0;
          __pyx_t_9 = 127;
          __Pyx_INCREF(__pyx_kp_u_String_length_must_be_at_least);
          __pyx_t_8 += 31;
          __Pyx_GIVEREF(__pyx_kp_u_String_length_must_be_at_least);
          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_String_length_must_be_at_least);
          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_min_length, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_9;
          __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __Pyx_INCREF(__pyx_kp_u_characters_got);
          __pyx_t_8 += 17;
          __Pyx_GIVEREF(__pyx_kp_u_characters_got);
          PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_characters_got);
          __pyx_t_10 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 371, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_10, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     372:                 val_type,

     373:                 annotated_type

     374:             )

     375:

     376:         # Max length validation

    +377:         if max_length is not None and len(value) > max_length:

        __pyx_t_7 = (__pyx_v_max_length != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 377, __pyx_L1_error)
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_max_length, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 377, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L12_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +378:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_3, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     379:                 name,

     380:                 value,

    +381:                 f"String length must be at most {max_length} characters, got {len(value)}",

          __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = 0;
          __pyx_t_9 = 127;
          __Pyx_INCREF(__pyx_kp_u_String_length_must_be_at_most);
          __pyx_t_8 += 30;
          __Pyx_GIVEREF(__pyx_kp_u_String_length_must_be_at_most);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_String_length_must_be_at_most);
          __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_max_length, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_9;
          __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
          __pyx_t_3 = 0;
          __Pyx_INCREF(__pyx_kp_u_characters_got);
          __pyx_t_8 += 17;
          __Pyx_GIVEREF(__pyx_kp_u_characters_got);
          PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_characters_got);
          __pyx_t_10 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 381, __pyx_L1_error)
          __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_10, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     382:                 val_type,

     383:                 annotated_type

     384:             )

     385:

     386:         # Pattern validation

    +387:         if pattern is not None:

        __pyx_t_1 = (__pyx_v_pattern != Py_None);
        if (__pyx_t_1) {
    /* … */
        }

    +388:             import re

          __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_re, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_v_re = __pyx_t_2;
          __pyx_t_2 = 0;

    +389:             if not re.match(pattern, value):

          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_re, __pyx_n_s_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = NULL;
          __pyx_t_6 = 0;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
              __pyx_t_6 = 1;
            }
          }
          #endif
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_pattern, __pyx_v_value};
            __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 389, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_7 = (!__pyx_t_1);
          if (__pyx_t_7) {
    /* … */
          }

    +390:                 return _create_error(

            __Pyx_XDECREF(__pyx_r);
    /* … */
            __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_3, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_r = ((PyObject*)__pyx_t_2);
            __pyx_t_2 = 0;
            goto __pyx_L0;

     391:                     name,

     392:                     value,

    +393:                     f"String does not match pattern {pattern}",

            __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_pattern, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_String_does_not_match_pattern, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     394:                     val_type,

     395:                     annotated_type

     396:                 )

     397:

     398:     # Numeric validations (int, float, Decimal)

    +399:     elif annotated_type in (int, float, Decimal):

      __Pyx_INCREF(__pyx_v_annotated_type);
      __pyx_t_2 = __pyx_v_annotated_type;
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_1) {
      } else {
        __pyx_t_7 = __pyx_t_1;
        goto __pyx_L16_bool_binop_done;
      }
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_1) {
      } else {
        __pyx_t_7 = __pyx_t_1;
        goto __pyx_L16_bool_binop_done;
      }
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __pyx_t_1;
      __pyx_L16_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __pyx_t_7;
      if (__pyx_t_1) {
    /* … */
      }
      __pyx_L4:;

    +400:         min_val = metadata.get('min', getattr(field, 'gt', None))

        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_gt, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_n_u_min, __pyx_t_3};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_min_val, __pyx_t_2);
        __pyx_t_2 = 0;

    +401:         max_val = metadata.get('max', getattr(field, 'lt', None))

        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_lt, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_n_u_max, __pyx_t_3};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_max_val, __pyx_t_2);
        __pyx_t_2 = 0;

    +402:         ge_val = getattr(field, 'ge', None)

        __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_ge, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_ge_val, __pyx_t_2);
        __pyx_t_2 = 0;

    +403:         le_val = getattr(field, 'le', None)

        __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_le, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_le_val, __pyx_t_2);
        __pyx_t_2 = 0;

    +404:         eq_val = getattr(field, 'eq', None)

        __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_eq, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_eq_val, __pyx_t_2);
        __pyx_t_2 = 0;

    +405:         ne_val = getattr(field, 'ne', None)

        __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_field, __pyx_n_u_ne, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_ne_val, __pyx_t_2);
        __pyx_t_2 = 0;

     406:         # Equal validation

    +407:         if eq_val is not None and value != eq_val:

        __pyx_t_7 = (__pyx_v_eq_val != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L20_bool_binop_done;
        }
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_v_eq_val, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 407, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L20_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +408:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     409:                 name,

     410:                 value,

    +411:                 f"Value must be equal to {eq_val}",

          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_eq_val, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_must_be_equal_to, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     412:                 val_type,

     413:                 annotated_type

     414:             )

     415:

     416:         # Not equal validation

    +417:         if ne_val is not None and value == ne_val:

        __pyx_t_7 = (__pyx_v_ne_val != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L23_bool_binop_done;
        }
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_v_ne_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 417, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L23_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +418:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     419:                 name,

     420:                 value,

    +421:                 f"Value must not be equal to {ne_val}",

          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_ne_val, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_must_not_be_equal_to, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     422:                 val_type,

     423:                 annotated_type

     424:             )

     425:

     426:         # Minimum value validation (greater than)

    +427:         if min_val is not None and value < min_val:  # inclusive

        __pyx_t_7 = (__pyx_v_min_val != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L26_bool_binop_done;
        }
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_v_min_val, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 427, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L26_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +428:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 428, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     429:                 name,

     430:                 value,

    +431:                 f"Value must be greater than {min_val}",

          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_min_val, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 431, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_must_be_greater_than, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     432:                 val_type,

     433:                 annotated_type

     434:             )

     435:

     436:         # Maximum value validation (less than)

    +437:         if max_val is not None and value > max_val:  # inclusive

        __pyx_t_7 = (__pyx_v_max_val != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L29_bool_binop_done;
        }
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_v_max_val, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 437, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L29_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +438:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     439:                 name,

     440:                 value,

    +441:                 f"Value must be less than {max_val}",

          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_max_val, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_must_be_less_than, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     442:                 val_type,

     443:                 annotated_type

     444:             )

     445:

     446:         # Greater than or equal validation

    +447:         if ge_val is not None and value < ge_val:

        __pyx_t_7 = (__pyx_v_ge_val != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L32_bool_binop_done;
        }
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_v_ge_val, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 447, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L32_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +448:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     449:                 name,

     450:                 value,

    +451:                 f"Value must be greater than or equal to {ge_val}",

          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_ge_val, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_must_be_greater_than_or_eq, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     452:                 val_type,

     453:                 annotated_type

     454:             )

     455:

     456:         # Less than or equal validation

    +457:         if le_val is not None and value > le_val:

        __pyx_t_7 = (__pyx_v_le_val != Py_None);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L35_bool_binop_done;
        }
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_v_le_val, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 457, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L35_bool_binop_done:;
        if (__pyx_t_1) {
    /* … */
        }

    +458:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_2 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 0;
          goto __pyx_L0;

     459:                 name,

     460:                 value,

    +461:                 f"Value must be less than or equal to {le_val}",

          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_le_val, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Value_must_be_less_than_or_equal, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     462:                 val_type,

     463:                 annotated_type

     464:             )

     465:

     466:     # If we've made it here, all validations passed

    +467:     return {}

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

     468:

    +469: cpdef dict _validation(

    static PyObject *__pyx_pw_9datamodel_10validation_3_validation(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_9datamodel_10validation__validation(PyObject *__pyx_v_F, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_annotated_type, PyObject *__pyx_v_val_type, PyObject *__pyx_v_field_type, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9datamodel_10validation__validation *__pyx_optional_args) {
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_14);
      __Pyx_XDECREF(__pyx_t_15);
      __Pyx_XDECREF(__pyx_t_17);
      __Pyx_AddTraceback("datamodel.validation._validation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_field_meta);
      __Pyx_XDECREF(__pyx_v_error);
      __Pyx_XDECREF(__pyx_v_allowed_values);
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XDECREF(__pyx_v_msg);
      __Pyx_XDECREF(__pyx_v_errors);
      __Pyx_XDECREF(__pyx_v_tuple_args);
      __Pyx_XDECREF(__pyx_v_element_type);
      __Pyx_XDECREF(__pyx_v_i);
      __Pyx_XDECREF(__pyx_v_elem);
      __Pyx_XDECREF(__pyx_v_elem_origin);
      __Pyx_XDECREF(__pyx_v_elem_type);
      __Pyx_XDECREF(__pyx_v_inner_types);
      __Pyx_XDECREF(__pyx_v_t);
      __Pyx_XDECREF(__pyx_v_base_type);
      __Pyx_XDECREF(__pyx_v_field);
      __Pyx_XDECREF(__pyx_v_e);
      __Pyx_XDECREF(__pyx_v_ftype);
      __Pyx_XDECREF(__pyx_v_pk_field);
      __Pyx_XDECREF(__pyx_v_pk_type);
      __Pyx_XDECREF(__pyx_v_fn);
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t);
      __Pyx_XDECREF(__pyx_v_annotated_type);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_9datamodel_10validation_3_validation(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_9datamodel_10validation_2_validation, "_validation(F, unicode name, value, annotated_type, val_type, unicode field_type, bool as_objects=False) -> dict");
    static PyMethodDef __pyx_mdef_9datamodel_10validation_3_validation = {"_validation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_10validation_3_validation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_10validation_2_validation};
    static PyObject *__pyx_pw_9datamodel_10validation_3_validation(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_F = 0;
      PyObject *__pyx_v_name = 0;
      PyObject *__pyx_v_value = 0;
      PyObject *__pyx_v_annotated_type = 0;
      PyObject *__pyx_v_val_type = 0;
      PyObject *__pyx_v_field_type = 0;
      int __pyx_v_as_objects;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_validation (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_MACROS
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_name,&__pyx_n_s_value,&__pyx_n_s_annotated_type,&__pyx_n_s_val_type,&__pyx_n_s_field_type,&__pyx_n_s_as_objects,0};
      PyObject* values[7] = {0,0,0,0,0,0,0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_F)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("_validation", 0, 6, 7, 1); __PYX_ERR(0, 469, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("_validation", 0, 6, 7, 2); __PYX_ERR(0, 469, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_annotated_type)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("_validation", 0, 6, 7, 3); __PYX_ERR(0, 469, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val_type)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("_validation", 0, 6, 7, 4); __PYX_ERR(0, 469, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_field_type)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[5]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("_validation", 0, 6, 7, 5); __PYX_ERR(0, 469, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_as_objects);
              if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
              else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_validation") < 0)) __PYX_ERR(0, 469, __pyx_L3_error)
          }
        } else {
          switch (__pyx_nargs) {
            case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
            values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
            values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
            values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
            values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
            values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_F = values[0];
        __pyx_v_name = ((PyObject*)values[1]);
        __pyx_v_value = values[2];
        __pyx_v_annotated_type = values[3];
        __pyx_v_val_type = values[4];
        __pyx_v_field_type = ((PyObject*)values[5]);
        if (values[6]) {
          __pyx_v_as_objects = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_as_objects == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L3_error)
        } else {
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      {
        Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
          __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
        }
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_9datamodel_10validation_2_validation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_F, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_annotated_type, PyObject *__pyx_v_val_type, PyObject *__pyx_v_field_type, int __pyx_v_as_objects) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.as_objects = __pyx_v_as_objects;
      __pyx_t_1 = __pyx_f_9datamodel_10validation__validation(__pyx_v_F, __pyx_v_name, __pyx_v_value, __pyx_v_annotated_type, __pyx_v_val_type, __pyx_v_field_type, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("datamodel.validation._validation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__22 = PyTuple_Pack(7, __pyx_n_s_F, __pyx_n_s_name, __pyx_n_s_value, __pyx_n_s_annotated_type, __pyx_n_s_val_type, __pyx_n_s_field_type, __pyx_n_s_as_objects); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__22);
      __Pyx_GIVEREF(__pyx_tuple__22);
      __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_validation_pyx, __pyx_n_s_validation, 469, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 469, __pyx_L1_error)
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9datamodel_10validation_3_validation, 0, __pyx_n_s_validation, NULL, __pyx_n_s_datamodel_validation, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__24);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_validation, __pyx_t_2) < 0) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_tuple__24 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__24);
      __Pyx_GIVEREF(__pyx_tuple__24);
    /* … */
    struct __pyx_opt_args_9datamodel_10validation__validation {
      int __pyx_n;
      int as_objects;
    };

     470:     object F,

     471:     str name,

     472:     object value,

     473:     object annotated_type,

     474:     object val_type,

     475:     str field_type,

    +476:     bint as_objects=False

      int __pyx_v_as_objects = ((int)0);
      int __pyx_v__valid;
      PyObject *__pyx_v_field_meta = 0;
      PyObject *__pyx_v_error = 0;
      PyObject *__pyx_v_allowed_values = 0;
      PyObject *__pyx_v_result = NULL;
      PyObject *__pyx_v_msg = NULL;
      PyObject *__pyx_v_errors = NULL;
      PyObject *__pyx_v_tuple_args = NULL;
      PyObject *__pyx_v_element_type = NULL;
      PyObject *__pyx_v_i = NULL;
      PyObject *__pyx_v_elem = NULL;
      PyObject *__pyx_v_elem_origin = NULL;
      PyObject *__pyx_v_elem_type = NULL;
      PyObject *__pyx_v_inner_types = NULL;
      PyObject *__pyx_v_t = NULL;
      PyObject *__pyx_v_base_type = NULL;
      PyObject *__pyx_v_field = NULL;
      PyObject *__pyx_v_e = NULL;
      PyObject *__pyx_v_ftype = NULL;
      PyObject *__pyx_v_pk_field = NULL;
      PyObject *__pyx_v_pk_type = NULL;
      int __pyx_v_instance;
      PyObject *__pyx_v_fn = NULL;
      PyObject *__pyx_8genexpr1__pyx_v_t = NULL;
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_as_objects = __pyx_optional_args->as_objects;
        }
      }
      __Pyx_INCREF(__pyx_v_annotated_type);
    /* … */
          __pyx_v_as_objects = ((int)0);
        }
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_validation", 0, 6, 7, __pyx_nargs); __PYX_ERR(0, 469, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      {
        Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
          __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
        }
      }
      __Pyx_AddTraceback("datamodel.validation._validation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 471, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field_type), (&PyUnicode_Type), 1, "field_type", 1))) __PYX_ERR(0, 475, __pyx_L1_error)
      __pyx_r = __pyx_pf_9datamodel_10validation_2_validation(__pyx_self, __pyx_v_F, __pyx_v_name, __pyx_v_value, __pyx_v_annotated_type, __pyx_v_val_type, __pyx_v_field_type, __pyx_v_as_objects);

     477: ):

    +478:     cdef bint _valid = False

      __pyx_v__valid = 0;

    +479:     cdef object field_meta = F.metadata

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_metadata); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_field_meta = __pyx_t_1;
      __pyx_t_1 = 0;

    +480:     cdef dict error = {}

      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_error = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +481:     cdef list allowed_values = []

      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_allowed_values = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     482:

    +483:     if not annotated_type:

      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_annotated_type); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 483, __pyx_L1_error)
      __pyx_t_3 = (!__pyx_t_2);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L3;
      }

    +484:         annotated_type = F.type

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_type_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF_SET(__pyx_v_annotated_type, __pyx_t_1);
        __pyx_t_1 = 0;

    +485:     elif isinstance(annotated_type, Field):

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Field_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_annotated_type, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 485, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {
    /* … */
      }
      __pyx_L3:;

    +486:         annotated_type = annotated_type.type

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_annotated_type, __pyx_n_s_type_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF_SET(__pyx_v_annotated_type, __pyx_t_1);
        __pyx_t_1 = 0;

     487:     # print('VAL > ', name, ' F ', F, ' VALUE > ', value)

    +488:     if fn := F.metadata.get('validator', None):

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_metadata); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_fn = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {
    /* … */
      }
    /* … */
      __pyx_tuple__16 = PyTuple_Pack(2, __pyx_n_u_validator, Py_None); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__16);
      __Pyx_GIVEREF(__pyx_tuple__16);

    +489:         try:

        {
          /*try:*/ {
    /* … */
          }
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L10_try_end;
          __pyx_L5_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    /* … */
          __pyx_L7_except_error:;
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
          goto __pyx_L1_error;
          __pyx_L9_try_return:;
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
          goto __pyx_L0;
          __pyx_L10_try_end:;
        }

    +490:             result = fn(F, value, annotated_type, val_type)

            __Pyx_INCREF(__pyx_v_fn);
            __pyx_t_4 = __pyx_v_fn; __pyx_t_8 = NULL;
            __pyx_t_9 = 0;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_8)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_8);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
                __pyx_t_9 = 1;
              }
            }
            #endif
            {
              PyObject *__pyx_callargs[5] = {__pyx_t_8, __pyx_v_F, __pyx_v_value, __pyx_v_annotated_type, __pyx_v_val_type};
              __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 4+__pyx_t_9);
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            }
            __pyx_v_result = __pyx_t_1;
            __pyx_t_1 = 0;

    +491:             if result is False:

            __pyx_t_3 = (__pyx_v_result == Py_False);
            if (__pyx_t_3) {
    /* … */
            }

    +492:                 msg = f"Validation failed for *{name}*: {value} with result: {result}"

              __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_10 = 0;
              __pyx_t_11 = 127;
              __Pyx_INCREF(__pyx_kp_u_Validation_failed_for);
              __pyx_t_10 += 23;
              __Pyx_GIVEREF(__pyx_kp_u_Validation_failed_for);
              PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Validation_failed_for);
              __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
              __pyx_t_4 = 0;
              __Pyx_INCREF(__pyx_kp_u__17);
              __pyx_t_10 += 3;
              __Pyx_GIVEREF(__pyx_kp_u__17);
              PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__17);
              __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
              __pyx_t_4 = 0;
              __Pyx_INCREF(__pyx_kp_u_with_result);
              __pyx_t_10 += 14;
              __Pyx_GIVEREF(__pyx_kp_u_with_result);
              PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_with_result);
              __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_result, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4);
              __pyx_t_4 = 0;
              __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __pyx_v_msg = ((PyObject*)__pyx_t_4);
              __pyx_t_4 = 0;

    +493:                 return _create_error(name, value, msg, val_type, annotated_type)

              __Pyx_XDECREF(__pyx_r);
              __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_v_msg, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 493, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_r = ((PyObject*)__pyx_t_4);
              __pyx_t_4 = 0;
              goto __pyx_L9_try_return;

    +494:         except ValueError:

          __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
          if (__pyx_t_12) {
            __Pyx_AddTraceback("datamodel.validation._validation", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 494, __pyx_L7_except_error)
            __Pyx_XGOTREF(__pyx_t_4);
            __Pyx_XGOTREF(__pyx_t_1);
            __Pyx_XGOTREF(__pyx_t_8);

    +495:             raise

            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_8);
            __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_8 = 0;
            __PYX_ERR(0, 495, __pyx_L7_except_error)
          }
          goto __pyx_L7_except_error;

     496:     # Check for primitive type constraints if the value is not None

    +497:     if F._type_category == 'primitive':

      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_type_category); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_n_u_primitive, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 497, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {
    /* … */
      }

    +498:         errors = _validate_constraints(F, name, value, annotated_type, val_type)

        __pyx_t_8 = __pyx_f_9datamodel_10validation__validate_constraints(__pyx_v_F, __pyx_v_name, __pyx_v_value, __pyx_v_annotated_type, __pyx_v_val_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 498, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_v_errors = ((PyObject*)__pyx_t_8);
        __pyx_t_8 = 0;

    +499:         if errors:

        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 499, __pyx_L1_error)
        if (__pyx_t_3) {
    /* … */
        }

    +500:             return errors

          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_errors);
          __pyx_r = __pyx_v_errors;
          goto __pyx_L0;

     501:     # check: data type hint

     502:     # If field_type is known, short-circuit certain checks

    +503:     if F.type == Text:

      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_type_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {
    /* … */
      }

    +504:         if val_type != str:

        __pyx_t_4 = PyObject_RichCompare(__pyx_v_val_type, ((PyObject *)(&PyUnicode_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 504, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_3) {
    /* … */
        }

    +505:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_1, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_r = ((PyObject*)__pyx_t_4);
          __pyx_t_4 = 0;
          goto __pyx_L0;

     506:                 name,

     507:                 value,

    +508:                 f'invalid type for {annotated_type}.{name}, expected {annotated_type}',

          __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_invalid_type_for);
          __pyx_t_10 += 17;
          __Pyx_GIVEREF(__pyx_kp_u_invalid_type_for);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_invalid_type_for);
          __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
          __pyx_t_1 = 0;
          __Pyx_INCREF(__pyx_kp_u__11);
          __pyx_t_10 += 1;
          __Pyx_GIVEREF(__pyx_kp_u__11);
          PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__11);
          __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1);
          __pyx_t_1 = 0;
          __Pyx_INCREF(__pyx_kp_u_expected);
          __pyx_t_10 += 11;
          __Pyx_GIVEREF(__pyx_kp_u_expected);
          PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u_expected);
          __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 6, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     509:                 val_type,

     510:                 annotated_type

     511:             )

    +512:         return {}

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L0;

     513:

    +514:     if is_enum_class(annotated_type):

      __pyx_t_3 = __pyx_f_9datamodel_10validation_is_enum_class(__pyx_v_annotated_type); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 514, __pyx_L1_error)
      if (__pyx_t_3) {
    /* … */
      }

    +515:         return validate_enum(name, value, annotated_type, val_type)

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __pyx_f_9datamodel_10validation_validate_enum(__pyx_v_name, __pyx_v_value, __pyx_v_annotated_type, __pyx_v_val_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L0;

     516:

    +517:     if F.origin is Callable:

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Callable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = (__pyx_t_4 == __pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_3) {
    /* … */
      }

    +518:         if not is_callable(value):

        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_is_callable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_8 = NULL;
        __pyx_t_9 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_9 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_value};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_2 = (!__pyx_t_3);
        if (__pyx_t_2) {
    /* … */
        }

    +519:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_1 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_1);
          __pyx_t_1 = 0;
          goto __pyx_L0;

    +520:                 name, value, f'Invalid function type, expected {annotated_type}', val_type, annotated_type

          __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_function_type_expected, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     521:             )

    +522:         return {}

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L0;

    +523:     elif F.origin is Awaitable:

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Awaitable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = (__pyx_t_1 == __pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
    /* … */
      }

    +524:         if asyncio.iscoroutinefunction(value):

        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_iscoroutinefunction); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 524, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        __pyx_t_9 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_9 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_value};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 524, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_2) {
    /* … */
        }

    +525:             return  _create_error(name, value, f"Field '{name}': provided coroutine function is not awaitable; call it to obtain a coroutine object.", val_type, annotated_type)

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_Field_3);
          __pyx_t_10 += 7;
          __Pyx_GIVEREF(__pyx_kp_u_Field_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Field_3);
          __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 525, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_INCREF(__pyx_kp_u_provided_coroutine_function_is);
          __pyx_t_10 += 86;
          __Pyx_GIVEREF(__pyx_kp_u_provided_coroutine_function_is);
          PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_provided_coroutine_function_is);
          __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 525, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_8, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_r = ((PyObject*)__pyx_t_4);
          __pyx_t_4 = 0;
          goto __pyx_L0;

     526:         # Otherwise, check if it is awaitable

    +527:         elif not hasattr(value, '__await__'):

        __pyx_t_2 = __Pyx_HasAttr(__pyx_v_value, __pyx_n_u_await); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 527, __pyx_L1_error)
        __pyx_t_3 = (!__pyx_t_2);
        if (__pyx_t_3) {
    /* … */
        }

    +528:             return _create_error(name, value, f"Field '{name}': provided object is not awaitable; it does not have an '__await__' method. but got {type(value)}.", val_type, annotated_type)

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_Field_3);
          __pyx_t_10 += 7;
          __Pyx_GIVEREF(__pyx_kp_u_Field_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Field_3);
          __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_INCREF(__pyx_kp_u_provided_object_is_not_awaitabl);
          __pyx_t_10 += 85;
          __Pyx_GIVEREF(__pyx_kp_u_provided_object_is_not_awaitabl);
          PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_provided_object_is_not_awaitabl);
          __pyx_t_8 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_INCREF(__pyx_kp_u__11);
          __pyx_t_10 += 1;
          __Pyx_GIVEREF(__pyx_kp_u__11);
          PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__11);
          __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_8, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_r = ((PyObject*)__pyx_t_4);
          __pyx_t_4 = 0;
          goto __pyx_L0;

    +529:         return {}

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L0;

    +530:     elif field_type == 'type':

      __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_field_type, __pyx_n_u_type_2, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 530, __pyx_L1_error)
      if (__pyx_t_3) {
    /* … */
      }

    +531:         return validate_type(F, name, value, annotated_type, val_type)

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __pyx_f_9datamodel_10validation_validate_type(__pyx_v_F, __pyx_v_name, __pyx_v_value, __pyx_v_annotated_type, __pyx_v_val_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L0;

     532:

    +533:     elif F.origin is Literal:

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Literal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = (__pyx_t_4 == __pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {
    /* … */
      }

    +534:         allowed_values = list(F.args)

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PySequence_ListKeepNew(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_allowed_values, ((PyObject*)__pyx_t_4));
        __pyx_t_4 = 0;

    +535:         if value not in allowed_values:

        __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_value, __pyx_v_allowed_values, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 535, __pyx_L1_error)
        if (__pyx_t_3) {
    /* … */
        }

    +536:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_8, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_r = ((PyObject*)__pyx_t_4);
          __pyx_t_4 = 0;
          goto __pyx_L0;

     537:                 name,

     538:                 value,

    +539:                 f"Invalid value for {annotated_type}.{name}, expected one of {allowed_values}",

          __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_Invalid_value_for);
          __pyx_t_10 += 18;
          __Pyx_GIVEREF(__pyx_kp_u_Invalid_value_for);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Invalid_value_for);
          __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_INCREF(__pyx_kp_u__11);
          __pyx_t_10 += 1;
          __Pyx_GIVEREF(__pyx_kp_u__11);
          PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__11);
          __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_INCREF(__pyx_kp_u_expected_one_of);
          __pyx_t_10 += 18;
          __Pyx_GIVEREF(__pyx_kp_u_expected_one_of);
          PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u_expected_one_of);
          __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_allowed_values, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_4, 6, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     540:                 val_type,

     541:                 annotated_type

     542:             )

    +543:         return {}

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = ((PyObject*)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L0;

     544:

     545:     # Handle Union (including Optional)

    +546:     elif F.origin is Union:

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Union); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = (__pyx_t_4 == __pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L19;
      }

     547:         # If None is allowed and value is None, it's valid

    +548:         if type(None) in F.args and value is None:

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = (__Pyx_PySequence_ContainsTF(((PyObject *)Py_TYPE(Py_None)), __pyx_t_8, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 548, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_2) {
        } else {
          __pyx_t_3 = __pyx_t_2;
          goto __pyx_L24_bool_binop_done;
        }
        __pyx_t_2 = (__pyx_v_value == Py_None);
        __pyx_t_3 = __pyx_t_2;
        __pyx_L24_bool_binop_done:;
        if (__pyx_t_3) {
    /* … */
        }

    +549:             return {}

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 549, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_r = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L0;

     550:         # return _validate_union_field(F, name, value, annotated_type)

    +551:     elif field_type == 'typing' or hasattr(annotated_type, '__module__') and annotated_type.__module__ == 'typing':

      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_field_type, __pyx_n_u_typing, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 551, __pyx_L1_error)
      if (!__pyx_t_2) {
      } else {
        __pyx_t_3 = __pyx_t_2;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_HasAttr(__pyx_v_annotated_type, __pyx_n_u_module); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 551, __pyx_L1_error)
      if (__pyx_t_2) {
      } else {
        __pyx_t_3 = __pyx_t_2;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_annotated_type, __pyx_n_s_module); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_n_u_typing, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 551, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = __pyx_t_2;
      __pyx_L26_bool_binop_done:;
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L19;
      }

    +552:         if F.origin is tuple:

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = (__pyx_t_8 == ((PyObject *)(&PyTuple_Type)));
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_3) {
    /* … */
        }

    +553:             tuple_args = F.args

          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 553, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_v_tuple_args = __pyx_t_8;
          __pyx_t_8 = 0;

     554:             # Check if we are in the homogeneous case: Tuple[T, ...]

    +555:             if len(tuple_args) == 2 and tuple_args[1] is Ellipsis:

          __pyx_t_10 = PyObject_Length(__pyx_v_tuple_args); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 555, __pyx_L1_error)
          __pyx_t_2 = (__pyx_t_10 == 2);
          if (__pyx_t_2) {
          } else {
            __pyx_t_3 = __pyx_t_2;
            goto __pyx_L31_bool_binop_done;
          }
          __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_tuple_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 555, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_2 = (__pyx_t_8 == __pyx_builtin_Ellipsis);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_3 = __pyx_t_2;
          __pyx_L31_bool_binop_done:;
          if (__pyx_t_3) {
    /* … */
          }

    +556:                 element_type = tuple_args[0]

            __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_tuple_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_v_element_type = __pyx_t_8;
            __pyx_t_8 = 0;

    +557:                 for i, elem in enumerate(value):

            __Pyx_INCREF(__pyx_int_0);
            __pyx_t_8 = __pyx_int_0;
            if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) {
              __pyx_t_4 = __pyx_v_value; __Pyx_INCREF(__pyx_t_4);
              __pyx_t_10 = 0;
              __pyx_t_13 = NULL;
            } else {
              __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 557, __pyx_L1_error)
            }
            for (;;) {
              if (likely(!__pyx_t_13)) {
                if (likely(PyList_CheckExact(__pyx_t_4))) {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
                    #if !CYTHON_ASSUME_SAFE_MACROS
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
                    #endif
                    if (__pyx_t_10 >= __pyx_temp) break;
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
                  #else
                  __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  #endif
                } else {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                    #if !CYTHON_ASSUME_SAFE_MACROS
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
                    #endif
                    if (__pyx_t_10 >= __pyx_temp) break;
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 557, __pyx_L1_error)
                  #else
                  __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  #endif
                }
              } else {
                __pyx_t_1 = __pyx_t_13(__pyx_t_4);
                if (unlikely(!__pyx_t_1)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else __PYX_ERR(0, 557, __pyx_L1_error)
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_1);
              }
              __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_1);
              __pyx_t_1 = 0;
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
              __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_8);
              __pyx_t_8 = __pyx_t_1;
              __pyx_t_1 = 0;
    /* … */
            }
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     558:                     # Can't use isinstance with generic types

    +559:                     elem_origin = get_origin(element_type)

              __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 559, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_15 = NULL;
              __pyx_t_9 = 0;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_14))) {
                __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
                if (likely(__pyx_t_15)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                  __Pyx_INCREF(__pyx_t_15);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_14, function);
                  __pyx_t_9 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_v_element_type};
                __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
                __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              }
              __Pyx_XDECREF_SET(__pyx_v_elem_origin, __pyx_t_1);
              __pyx_t_1 = 0;

    +560:                     if elem_origin is None:

              __pyx_t_3 = (__pyx_v_elem_origin == Py_None);
              if (__pyx_t_3) {
    /* … */
                goto __pyx_L35;
              }

    +561:                         if not isinstance(elem, element_type):

                __pyx_t_3 = PyObject_IsInstance(__pyx_v_elem, __pyx_v_element_type); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 561, __pyx_L1_error)
                __pyx_t_2 = (!__pyx_t_3);
                if (__pyx_t_2) {
    /* … */
                }

    +562:                             return _create_error(

                  __Pyx_XDECREF(__pyx_r);
    /* … */
                  __pyx_t_1 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_t_14), __pyx_v_elem, __pyx_t_15, ((PyObject *)Py_TYPE(__pyx_v_elem)), __pyx_v_element_type, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __pyx_r = ((PyObject*)__pyx_t_1);
                  __pyx_t_1 = 0;
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                  goto __pyx_L0;

    +563:                                 f"{name}[{i}]",

                  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_16 = 0;
                  __pyx_t_11 = 127;
                  __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 563, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
                  __Pyx_GIVEREF(__pyx_t_14);
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_14);
                  __pyx_t_14 = 0;
                  __Pyx_INCREF(__pyx_kp_u__7);
                  __pyx_t_16 += 1;
                  __Pyx_GIVEREF(__pyx_kp_u__7);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__7);
                  __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 563, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
                  __Pyx_GIVEREF(__pyx_t_14);
                  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_14);
                  __pyx_t_14 = 0;
                  __Pyx_INCREF(__pyx_kp_u__8);
                  __pyx_t_16 += 1;
                  __Pyx_GIVEREF(__pyx_kp_u__8);
                  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__8);
                  __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 563, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     564:                                 elem,

    +565:                                 f"Invalid type at index {i}: expected {element_type}",

                  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_16 = 0;
                  __pyx_t_11 = 127;
                  __Pyx_INCREF(__pyx_kp_u_Invalid_type_at_index);
                  __pyx_t_16 += 22;
                  __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_at_index);
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_type_at_index);
                  __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 565, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __Pyx_INCREF(__pyx_kp_u_expected_2);
                  __pyx_t_16 += 11;
                  __Pyx_GIVEREF(__pyx_kp_u_expected_2);
                  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_expected_2);
                  __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_v_element_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 565, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 565, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     566:                                 type(elem), element_type

     567:                             )

     568:                     else:

    +569:                         if not is_instanceof(elem, element_type):

              /*else*/ {
                if (!(likely(PyType_CheckExact(__pyx_v_element_type))||((__pyx_v_element_type) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_v_element_type))) __PYX_ERR(0, 569, __pyx_L1_error)
                __pyx_t_2 = __pyx_f_9datamodel_10validation_is_instanceof(__pyx_v_elem, ((PyTypeObject*)__pyx_v_element_type)); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error)
                __pyx_t_3 = (!__pyx_t_2);
                if (__pyx_t_3) {
    /* … */
                }
              }
              __pyx_L35:;

    +570:                             return _create_error(

                  __Pyx_XDECREF(__pyx_r);
    /* … */
                  __pyx_t_1 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_t_15), __pyx_v_elem, __pyx_t_14, ((PyObject *)Py_TYPE(__pyx_v_elem)), __pyx_v_element_type, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __pyx_r = ((PyObject*)__pyx_t_1);
                  __pyx_t_1 = 0;
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                  goto __pyx_L0;

    +571:                                 f"{name}[{i}]",

                  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_16 = 0;
                  __pyx_t_11 = 127;
                  __pyx_t_15 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 571, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __Pyx_INCREF(__pyx_kp_u__7);
                  __pyx_t_16 += 1;
                  __Pyx_GIVEREF(__pyx_kp_u__7);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__7);
                  __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 571, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __Pyx_INCREF(__pyx_kp_u__8);
                  __pyx_t_16 += 1;
                  __Pyx_GIVEREF(__pyx_kp_u__8);
                  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__8);
                  __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 571, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     572:                                 elem,

    +573:                                 f"Invalid type at index {i}: expected {element_type}",

                  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __pyx_t_16 = 0;
                  __pyx_t_11 = 127;
                  __Pyx_INCREF(__pyx_kp_u_Invalid_type_at_index);
                  __pyx_t_16 += 22;
                  __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_at_index);
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_type_at_index);
                  __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 573, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
                  __Pyx_GIVEREF(__pyx_t_14);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14);
                  __pyx_t_14 = 0;
                  __Pyx_INCREF(__pyx_kp_u_expected_2);
                  __pyx_t_16 += 11;
                  __Pyx_GIVEREF(__pyx_kp_u_expected_2);
                  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_expected_2);
                  __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_element_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 573, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
                  __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
                  __Pyx_GIVEREF(__pyx_t_14);
                  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_14);
                  __pyx_t_14 = 0;
                  __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 573, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     574:                                 type(elem), element_type

     575:                             )

    +576:                     if not isinstance(elem, F.args[0]):

              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 576, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __pyx_t_3 = PyObject_IsInstance(__pyx_v_elem, __pyx_t_14); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 576, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __pyx_t_2 = (!__pyx_t_3);
              if (__pyx_t_2) {
    /* … */
              }

    +577:                         return _create_error(

                __Pyx_XDECREF(__pyx_r);
    /* … */
                __pyx_t_14 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_t_1), __pyx_v_elem, __pyx_t_15, ((PyObject *)Py_TYPE(__pyx_v_elem)), __pyx_t_17, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 577, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                __pyx_r = ((PyObject*)__pyx_t_14);
                __pyx_t_14 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                goto __pyx_L0;

    +578:                             f"{name}[{i}]",

                __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 578, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_16 = 0;
                __pyx_t_11 = 127;
                __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_11;
                __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
                __Pyx_GIVEREF(__pyx_t_1);
                PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
                __pyx_t_1 = 0;
                __Pyx_INCREF(__pyx_kp_u__7);
                __pyx_t_16 += 1;
                __Pyx_GIVEREF(__pyx_kp_u__7);
                PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_kp_u__7);
                __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_11;
                __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
                __Pyx_GIVEREF(__pyx_t_1);
                PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_1);
                __pyx_t_1 = 0;
                __Pyx_INCREF(__pyx_kp_u__8);
                __pyx_t_16 += 1;
                __Pyx_GIVEREF(__pyx_kp_u__8);
                PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_kp_u__8);
                __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

     579:                             elem,

    +580:                             f"Invalid type at index {i}: expected {F.args[0]}",

                __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 580, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_16 = 0;
                __pyx_t_11 = 127;
                __Pyx_INCREF(__pyx_kp_u_Invalid_type_at_index);
                __pyx_t_16 += 22;
                __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_at_index);
                PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_kp_u_Invalid_type_at_index);
                __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 580, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_15);
                __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                __Pyx_GIVEREF(__pyx_t_15);
                PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_15);
                __pyx_t_15 = 0;
                __Pyx_INCREF(__pyx_kp_u_expected_2);
                __pyx_t_16 += 11;
                __Pyx_GIVEREF(__pyx_kp_u_expected_2);
                PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_kp_u_expected_2);
                __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 580, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_15);
                __pyx_t_17 = __Pyx_GetItemInt(__pyx_t_15, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 580, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_t_17, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 580, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_15);
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                __Pyx_GIVEREF(__pyx_t_15);
                PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_15);
                __pyx_t_15 = 0;
                __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 580, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_15);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    +581:                             type(elem), F.args[0]

                __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 581, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_17 = __Pyx_GetItemInt(__pyx_t_14, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 581, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

     582:                         )

    +583:                 return {}

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 583, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_r = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
            goto __pyx_L0;

     584:             else:

    +585:                 if len(value) != len(F.args):

          /*else*/ {
            __pyx_t_10 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 585, __pyx_L1_error)
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 585, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_16 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 585, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_2 = (__pyx_t_10 != __pyx_t_16);
            if (__pyx_t_2) {
    /* … */
            }

    +586:                     return _create_error(name, value, f"Invalid length for {annotated_type}.{name}, expected {len(F.args)} elements", val_type, annotated_type)

              __Pyx_XDECREF(__pyx_r);
              __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_16 = 0;
              __pyx_t_11 = 127;
              __Pyx_INCREF(__pyx_kp_u_Invalid_length_for);
              __pyx_t_16 += 19;
              __Pyx_GIVEREF(__pyx_kp_u_Invalid_length_for);
              PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_length_for);
              __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
              __pyx_t_4 = 0;
              __Pyx_INCREF(__pyx_kp_u__11);
              __pyx_t_16 += 1;
              __Pyx_GIVEREF(__pyx_kp_u__11);
              PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
              __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
              __pyx_t_4 = 0;
              __Pyx_INCREF(__pyx_kp_u_expected);
              __pyx_t_16 += 11;
              __Pyx_GIVEREF(__pyx_kp_u_expected);
              PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected);
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_10 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_10, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_4);
              __pyx_t_4 = 0;
              __Pyx_INCREF(__pyx_kp_u_elements);
              __pyx_t_16 += 9;
              __Pyx_GIVEREF(__pyx_kp_u_elements);
              PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_kp_u_elements);
              __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 7, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 586, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __pyx_r = ((PyObject*)__pyx_t_8);
              __pyx_t_8 = 0;
              goto __pyx_L0;

     587:                 else:

    +588:                     for i, (elem, elem_type) in enumerate(zip(value, F.args)):

            /*else*/ {
              __Pyx_INCREF(__pyx_int_0);
              __pyx_t_8 = __pyx_int_0;
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 588, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_INCREF(__pyx_v_value);
              __Pyx_GIVEREF(__pyx_v_value);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_value)) __PYX_ERR(0, 588, __pyx_L1_error);
              __Pyx_GIVEREF(__pyx_t_4);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error);
              __pyx_t_4 = 0;
              __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
                __pyx_t_14 = __pyx_t_4; __Pyx_INCREF(__pyx_t_14);
                __pyx_t_16 = 0;
                __pyx_t_13 = NULL;
              } else {
                __pyx_t_16 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 588, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 588, __pyx_L1_error)
              }
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              for (;;) {
                if (likely(!__pyx_t_13)) {
                  if (likely(PyList_CheckExact(__pyx_t_14))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_14);
                      #if !CYTHON_ASSUME_SAFE_MACROS
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 588, __pyx_L1_error)
                      #endif
                      if (__pyx_t_16 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_4); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 588, __pyx_L1_error)
                    #else
                    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
                    __Pyx_GOTREF(__pyx_t_4);
                    #endif
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_14);
                      #if !CYTHON_ASSUME_SAFE_MACROS
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 588, __pyx_L1_error)
                      #endif
                      if (__pyx_t_16 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_4); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 588, __pyx_L1_error)
                    #else
                    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
                    __Pyx_GOTREF(__pyx_t_4);
                    #endif
                  }
                } else {
                  __pyx_t_4 = __pyx_t_13(__pyx_t_14);
                  if (unlikely(!__pyx_t_4)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                      else __PYX_ERR(0, 588, __pyx_L1_error)
                    }
                    break;
                  }
                  __Pyx_GOTREF(__pyx_t_4);
                }
                if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
                  PyObject* sequence = __pyx_t_4;
                  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
                  if (unlikely(size != 2)) {
                    if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                    else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                    __PYX_ERR(0, 588, __pyx_L1_error)
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  if (likely(PyTuple_CheckExact(sequence))) {
                    __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0);
                    __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1);
                  } else {
                    __pyx_t_17 = PyList_GET_ITEM(sequence, 0);
                    __pyx_t_15 = PyList_GET_ITEM(sequence, 1);
                  }
                  __Pyx_INCREF(__pyx_t_17);
                  __Pyx_INCREF(__pyx_t_15);
                  #else
                  __pyx_t_17 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 588, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 588, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  #endif
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                } else {
                  Py_ssize_t index = -1;
                  __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                  __pyx_t_18 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1);
                  index = 0; __pyx_t_17 = __pyx_t_18(__pyx_t_1); if (unlikely(!__pyx_t_17)) goto __pyx_L43_unpacking_failed;
                  __Pyx_GOTREF(__pyx_t_17);
                  index = 1; __pyx_t_15 = __pyx_t_18(__pyx_t_1); if (unlikely(!__pyx_t_15)) goto __pyx_L43_unpacking_failed;
                  __Pyx_GOTREF(__pyx_t_15);
                  if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_1), 2) < 0) __PYX_ERR(0, 588, __pyx_L1_error)
                  __pyx_t_18 = NULL;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  goto __pyx_L44_unpacking_done;
                  __pyx_L43_unpacking_failed:;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __pyx_t_18 = NULL;
                  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                  __PYX_ERR(0, 588, __pyx_L1_error)
                  __pyx_L44_unpacking_done:;
                }
                __Pyx_XDECREF_SET(__pyx_v_elem, __pyx_t_17);
                __pyx_t_17 = 0;
                __Pyx_XDECREF_SET(__pyx_v_elem_type, __pyx_t_15);
                __pyx_t_15 = 0;
                __Pyx_INCREF(__pyx_t_8);
                __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
                __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_8);
                __pyx_t_8 = __pyx_t_4;
                __pyx_t_4 = 0;
    /* … */
              }
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }

    +589:                         elem_origin = get_origin(elem_type)

                __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 589, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_15);
                __pyx_t_17 = NULL;
                __pyx_t_9 = 0;
                #if CYTHON_UNPACK_METHODS
                if (unlikely(PyMethod_Check(__pyx_t_15))) {
                  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_15);
                  if (likely(__pyx_t_17)) {
                    PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                    __Pyx_INCREF(__pyx_t_17);
                    __Pyx_INCREF(function);
                    __Pyx_DECREF_SET(__pyx_t_15, function);
                    __pyx_t_9 = 1;
                  }
                }
                #endif
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_v_elem_type};
                  __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
                  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 589, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                }
                __Pyx_XDECREF_SET(__pyx_v_elem_origin, __pyx_t_4);
                __pyx_t_4 = 0;

    +590:                         if elem_origin is None and not isinstance(elem, elem_type):

                __pyx_t_3 = (__pyx_v_elem_origin == Py_None);
                if (__pyx_t_3) {
                } else {
                  __pyx_t_2 = __pyx_t_3;
                  goto __pyx_L46_bool_binop_done;
                }
                __pyx_t_3 = PyObject_IsInstance(__pyx_v_elem, __pyx_v_elem_type); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 590, __pyx_L1_error)
                __pyx_t_19 = (!__pyx_t_3);
                __pyx_t_2 = __pyx_t_19;
                __pyx_L46_bool_binop_done:;
                if (__pyx_t_2) {
    /* … */
                }

    +591:                             return _create_error(

                  __Pyx_XDECREF(__pyx_r);
    /* … */
                  __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_t_15), __pyx_v_elem, __pyx_t_17, ((PyObject *)Py_TYPE(__pyx_v_elem)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 591, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __pyx_r = ((PyObject*)__pyx_t_4);
                  __pyx_t_4 = 0;
                  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  goto __pyx_L0;

    +592:                                 f"{name}[{i}]",

                  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_10 = 0;
                  __pyx_t_11 = 127;
                  __pyx_t_15 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __Pyx_INCREF(__pyx_kp_u__7);
                  __pyx_t_10 += 1;
                  __Pyx_GIVEREF(__pyx_kp_u__7);
                  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u__7);
                  __pyx_t_15 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_15) : __pyx_t_11;
                  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_15);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_15);
                  __pyx_t_15 = 0;
                  __Pyx_INCREF(__pyx_kp_u__8);
                  __pyx_t_10 += 1;
                  __Pyx_GIVEREF(__pyx_kp_u__8);
                  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_kp_u__8);
                  __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     593:                                 elem,

    +594:                                 f"Invalid type at index {i}: expected {F.args[i]}",

                  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_10 = 0;
                  __pyx_t_11 = 127;
                  __Pyx_INCREF(__pyx_kp_u_Invalid_type_at_index);
                  __pyx_t_10 += 22;
                  __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_at_index);
                  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Invalid_type_at_index);
                  __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_v_i, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 594, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_11;
                  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                  __Pyx_GIVEREF(__pyx_t_17);
                  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_17);
                  __pyx_t_17 = 0;
                  __Pyx_INCREF(__pyx_kp_u_expected_2);
                  __pyx_t_10 += 11;
                  __Pyx_GIVEREF(__pyx_kp_u_expected_2);
                  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_expected_2);
                  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 594, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                  __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 594, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_11;
                  __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                  __Pyx_GIVEREF(__pyx_t_17);
                  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_17);
                  __pyx_t_17 = 0;
                  __pyx_t_17 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 594, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_17);
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +595:                                 type(elem), F.args[i]

                  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_4);
                  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     596:                             )

    +597:                 return {}

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 597, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_r = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
            goto __pyx_L0;
          }

    +598:         elif F.origin is list:

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 598, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = (__pyx_t_8 == ((PyObject *)(&PyList_Type)));
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_2) {
    /* … */
        }

    +599:             if not isinstance(value, list):

          __pyx_t_2 = PyList_Check(__pyx_v_value);
          __pyx_t_19 = (!__pyx_t_2);
          if (__pyx_t_19) {
    /* … */
          }

    +600:                 return _create_error(

            __Pyx_XDECREF(__pyx_r);
    /* … */
            __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_14, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 600, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_r = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
            goto __pyx_L0;

     601:                     name,

     602:                     value,

    +603:                     f"Invalid type for {annotated_type}.{name}, expected list",

            __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 603, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_16 = 0;
            __pyx_t_11 = 127;
            __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
            __pyx_t_16 += 17;
            __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
            __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 603, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u__11);
            __pyx_t_16 += 1;
            __Pyx_GIVEREF(__pyx_kp_u__11);
            PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
            __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 603, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u_expected_list);
            __pyx_t_16 += 15;
            __Pyx_GIVEREF(__pyx_kp_u_expected_list);
            PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected_list);
            __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 603, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     604:                     val_type,

     605:                     annotated_type

     606:                 )

     607:             # List content validation is more complex and should be done in parsing

    +608:             return {}

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_r = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L0;

     609:         # For sets

    +610:         elif F.origin in (set, frozenset):

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 610, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_14 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)(&PySet_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 610, __pyx_L1_error)
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (!__pyx_t_2) {
        } else {
          __pyx_t_19 = __pyx_t_2;
          goto __pyx_L50_bool_binop_done;
        }
        __pyx_t_14 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)(&PyFrozenSet_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 610, __pyx_L1_error)
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 610, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_19 = __pyx_t_2;
        __pyx_L50_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_2 = __pyx_t_19;
        if (__pyx_t_2) {
    /* … */
        }

    +611:             if not isinstance(value, F.origin):

          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 611, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_8); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 611, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_19 = (!__pyx_t_2);
          if (__pyx_t_19) {
    /* … */
          }

    +612:                 return _create_error(

            __Pyx_XDECREF(__pyx_r);
    /* … */
            __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 612, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_r = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
            goto __pyx_L0;

     613:                     name,

     614:                     value,

    +615:                     f"Invalid type for {annotated_type}.{name}, expected {F.origin}",

            __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 615, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_16 = 0;
            __pyx_t_11 = 127;
            __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
            __pyx_t_16 += 17;
            __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
            __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 615, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u__11);
            __pyx_t_16 += 1;
            __Pyx_GIVEREF(__pyx_kp_u__11);
            PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
            __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 615, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u_expected);
            __pyx_t_16 += 11;
            __Pyx_GIVEREF(__pyx_kp_u_expected);
            PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected);
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 615, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_14, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 615, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_4);
            __pyx_t_4 = 0;
            __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 615, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     616:                     val_type,

     617:                     annotated_type

     618:                 )

    +619:             return {}

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_r = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L0;

     620:         # For dictionaries

    +621:         elif F.origin is dict:

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 621, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_19 = (__pyx_t_8 == ((PyObject *)(&PyDict_Type)));
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_19) {
    /* … */
        }

    +622:             if not isinstance(value, dict):

          __pyx_t_19 = PyDict_Check(__pyx_v_value);
          __pyx_t_2 = (!__pyx_t_19);
          if (__pyx_t_2) {
    /* … */
          }

    +623:                 return _create_error(

            __Pyx_XDECREF(__pyx_r);
    /* … */
            __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 623, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_r = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
            goto __pyx_L0;

     624:                     name,

     625:                     value,

    +626:                     f"Invalid type for {annotated_type}.{name}, expected dict",

            __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_16 = 0;
            __pyx_t_11 = 127;
            __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
            __pyx_t_16 += 17;
            __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
            __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
            __pyx_t_4 = 0;
            __Pyx_INCREF(__pyx_kp_u__11);
            __pyx_t_16 += 1;
            __Pyx_GIVEREF(__pyx_kp_u__11);
            PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
            __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
            __pyx_t_4 = 0;
            __Pyx_INCREF(__pyx_kp_u_expected_dict);
            __pyx_t_16 += 15;
            __Pyx_GIVEREF(__pyx_kp_u_expected_dict);
            PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected_dict);
            __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     627:                     val_type,

     628:                     annotated_type

     629:                 )

    +630:             return {}

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 630, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_r = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L0;

     631:         # Handle Optional Types:

    +632:         elif F.origin is Union and type(None) in F.args:

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_origin_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 632, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Union); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_19 = (__pyx_t_8 == __pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_19) {
        } else {
          __pyx_t_2 = __pyx_t_19;
          goto __pyx_L54_bool_binop_done;
        }
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_19 = (__Pyx_PySequence_ContainsTF(((PyObject *)Py_TYPE(Py_None)), __pyx_t_4, Py_EQ)); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_2 = __pyx_t_19;
        __pyx_L54_bool_binop_done:;
        if (__pyx_t_2) {
    /* … */
        }

    +633:             inner_types = [t for t in F.args if t is not type(None)]

          { /* enter inner scope */
            __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L58_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L58_error)
            __Pyx_GOTREF(__pyx_t_8);
            if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
              __pyx_t_14 = __pyx_t_8; __Pyx_INCREF(__pyx_t_14);
              __pyx_t_16 = 0;
              __pyx_t_13 = NULL;
            } else {
              __pyx_t_16 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 633, __pyx_L58_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 633, __pyx_L58_error)
            }
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            for (;;) {
              if (likely(!__pyx_t_13)) {
                if (likely(PyList_CheckExact(__pyx_t_14))) {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_14);
                    #if !CYTHON_ASSUME_SAFE_MACROS
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 633, __pyx_L58_error)
                    #endif
                    if (__pyx_t_16 >= __pyx_temp) break;
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_8 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 633, __pyx_L58_error)
                  #else
                  __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L58_error)
                  __Pyx_GOTREF(__pyx_t_8);
                  #endif
                } else {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_14);
                    #if !CYTHON_ASSUME_SAFE_MACROS
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 633, __pyx_L58_error)
                    #endif
                    if (__pyx_t_16 >= __pyx_temp) break;
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_8); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 633, __pyx_L58_error)
                  #else
                  __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L58_error)
                  __Pyx_GOTREF(__pyx_t_8);
                  #endif
                }
              } else {
                __pyx_t_8 = __pyx_t_13(__pyx_t_14);
                if (unlikely(!__pyx_t_8)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else __PYX_ERR(0, 633, __pyx_L58_error)
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_8);
              }
              __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_t, __pyx_t_8);
              __pyx_t_8 = 0;
              __pyx_t_2 = (__pyx_8genexpr1__pyx_v_t != ((PyObject *)Py_TYPE(Py_None)));
              if (__pyx_t_2) {
                if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_8genexpr1__pyx_v_t))) __PYX_ERR(0, 633, __pyx_L58_error)
              }
            }
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t); __pyx_8genexpr1__pyx_v_t = 0;
            goto __pyx_L63_exit_scope;
            __pyx_L58_error:;
            __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t); __pyx_8genexpr1__pyx_v_t = 0;
            goto __pyx_L1_error;
            __pyx_L63_exit_scope:;
          } /* exit inner scope */
          __pyx_v_inner_types = __pyx_t_4;
          __pyx_t_4 = 0;

     634:             # If value is None then that is valid:

    +635:             if value is None:

          __pyx_t_2 = (__pyx_v_value == Py_None);
          if (__pyx_t_2) {
    /* … */
          }

    +636:                 return {}

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_r = ((PyObject*)__pyx_t_4);
            __pyx_t_4 = 0;
            goto __pyx_L0;

     637:             # Otherwise check that value is an instance of at least one inner type:

    +638:             for t in inner_types:

          __pyx_t_4 = __pyx_v_inner_types; __Pyx_INCREF(__pyx_t_4);
          __pyx_t_16 = 0;
          for (;;) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 638, __pyx_L1_error)
              #endif
              if (__pyx_t_16 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_14 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_14); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 638, __pyx_L1_error)
            #else
            __pyx_t_14 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 638, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_14);
            __pyx_t_14 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L70_for_end;
          __pyx_L66_break:;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L70_for_end;
          __pyx_L70_for_end:;

    +639:                 base_type = get_origin(t) or t

            __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_origin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_17 = NULL;
            __pyx_t_9 = 0;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_17)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_17);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
                __pyx_t_9 = 1;
              }
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_v_t};
              __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
              __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
              if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 639, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 639, __pyx_L1_error)
            if (!__pyx_t_2) {
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            } else {
              __Pyx_INCREF(__pyx_t_8);
              __pyx_t_14 = __pyx_t_8;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              goto __pyx_L67_bool_binop_done;
            }
            __Pyx_INCREF(__pyx_v_t);
            __pyx_t_14 = __pyx_v_t;
            __pyx_L67_bool_binop_done:;
            __Pyx_XDECREF_SET(__pyx_v_base_type, __pyx_t_14);
            __pyx_t_14 = 0;

    +640:                 if isinstance(value, base_type):

            __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_v_base_type); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 640, __pyx_L1_error)
            if (__pyx_t_2) {
    /* … */
            }

    +641:                     _valid = True

              __pyx_v__valid = 1;

    +642:                     break

              goto __pyx_L66_break;

    +643:             if not _valid:

          __pyx_t_2 = (!__pyx_v__valid);
          if (__pyx_t_2) {
    /* … */
          }

    +644:                 return _create_error(

            __Pyx_XDECREF(__pyx_r);
    /* … */
            __pyx_t_4 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_14, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 644, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_r = ((PyObject*)__pyx_t_4);
            __pyx_t_4 = 0;
            goto __pyx_L0;

     645:                     name,

     646:                     value,

    +647:                     f"Invalid type for {annotated_type}.{name}, expected one of {inner_types}",

            __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_16 = 0;
            __pyx_t_11 = 127;
            __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
            __pyx_t_16 += 17;
            __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Invalid_type_for);
            __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 647, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u__11);
            __pyx_t_16 += 1;
            __Pyx_GIVEREF(__pyx_kp_u__11);
            PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__11);
            __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 647, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u_expected_one_of);
            __pyx_t_16 += 18;
            __Pyx_GIVEREF(__pyx_kp_u_expected_one_of);
            PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u_expected_one_of);
            __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_inner_types, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 647, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_4, 6, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 647, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     648:                     val_type,

     649:                     annotated_type

     650:                 )

    +651:     elif type(annotated_type).__name__ == "ModelMeta":

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_annotated_type)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_ModelMeta, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L19;
      }

     652:         # Check if there's a field in the annotated type that matches the name and type

    +653:         if as_objects:

        if (__pyx_v_as_objects) {
    /* … */
          goto __pyx_L72;
        }

    +654:             if isinstance(value, annotated_type):

          __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_v_annotated_type); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 654, __pyx_L1_error)
          if (__pyx_t_2) {
    /* … */
          }

     655:                 # if value is already a Object, no further check needed for columns

    +656:                 return {}

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_r = ((PyObject*)__pyx_t_4);
            __pyx_t_4 = 0;
            goto __pyx_L0;

    +657:             try:

          {
            /*try:*/ {
    /* … */
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            goto __pyx_L79_try_end;
            __pyx_L74_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    /* … */
            __pyx_L76_except_error:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
            goto __pyx_L1_error;
            __pyx_L77_except_return:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
            goto __pyx_L0;
            __pyx_L79_try_end:;
          }

    +658:                 field = annotated_type.get_column(name)

              __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_annotated_type, __pyx_n_s_get_column); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 658, __pyx_L74_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_8 = NULL;
              __pyx_t_9 = 0;
              #if CYTHON_UNPACK_METHODS
              if (likely(PyMethod_Check(__pyx_t_14))) {
                __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_14);
                if (likely(__pyx_t_8)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
                  __Pyx_INCREF(__pyx_t_8);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_14, function);
                  __pyx_t_9 = 1;
                }
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_name};
                __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
                __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L74_error)
                __Pyx_GOTREF(__pyx_t_4);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              }
              __pyx_v_field = __pyx_t_4;
              __pyx_t_4 = 0;

    +659:             except AttributeError as e:

            __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
            if (__pyx_t_12) {
              __Pyx_AddTraceback("datamodel.validation._validation", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_14, &__pyx_t_8) < 0) __PYX_ERR(0, 659, __pyx_L76_except_error)
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_14);
              __Pyx_XGOTREF(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_14);
              __pyx_v_e = __pyx_t_14;
              /*try:*/ {
    /* … */
              /*finally:*/ {
                __pyx_L85_error:;
                /*exception exit:*/{
                  __Pyx_PyThreadState_declare
                  __Pyx_PyThreadState_assign
                  __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
                  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
                  if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_26, &__pyx_t_27, &__pyx_t_28);
                  if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
                  __Pyx_XGOTREF(__pyx_t_23);
                  __Pyx_XGOTREF(__pyx_t_24);
                  __Pyx_XGOTREF(__pyx_t_25);
                  __Pyx_XGOTREF(__pyx_t_26);
                  __Pyx_XGOTREF(__pyx_t_27);
                  __Pyx_XGOTREF(__pyx_t_28);
                  __pyx_t_12 = __pyx_lineno; __pyx_t_21 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
                  {
                    __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                  }
                  if (PY_MAJOR_VERSION >= 3) {
                    __Pyx_XGIVEREF(__pyx_t_26);
                    __Pyx_XGIVEREF(__pyx_t_27);
                    __Pyx_XGIVEREF(__pyx_t_28);
                    __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_27, __pyx_t_28);
                  }
                  __Pyx_XGIVEREF(__pyx_t_23);
                  __Pyx_XGIVEREF(__pyx_t_24);
                  __Pyx_XGIVEREF(__pyx_t_25);
                  __Pyx_ErrRestore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
                  __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
                  __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_21; __pyx_filename = __pyx_t_22;
                  goto __pyx_L76_except_error;
                }
                __pyx_L84_return: {
                  __pyx_t_29 = __pyx_r;
                  __pyx_r = 0;
                  __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
                  __pyx_r = __pyx_t_29;
                  __pyx_t_29 = 0;
                  goto __pyx_L77_except_return;
                }
              }
            }
            goto __pyx_L76_except_error;

    +660:                 return _create_error(name, value, f'{annotated_type} has no column {name}', val_type, annotated_type, e)

                __Pyx_XDECREF(__pyx_r);
                __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L85_error)
                __Pyx_GOTREF(__pyx_t_1);
                __pyx_t_16 = 0;
                __pyx_t_11 = 127;
                __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 660, __pyx_L85_error)
                __Pyx_GOTREF(__pyx_t_17);
                __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_11;
                __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                __Pyx_GIVEREF(__pyx_t_17);
                PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17);
                __pyx_t_17 = 0;
                __Pyx_INCREF(__pyx_kp_u_has_no_column);
                __pyx_t_16 += 15;
                __Pyx_GIVEREF(__pyx_kp_u_has_no_column);
                PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_has_no_column);
                __pyx_t_17 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 660, __pyx_L85_error)
                __Pyx_GOTREF(__pyx_t_17);
                __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_11;
                __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17);
                __Pyx_GIVEREF(__pyx_t_17);
                PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_17);
                __pyx_t_17 = 0;
                __pyx_t_17 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 660, __pyx_L85_error)
                __Pyx_GOTREF(__pyx_t_17);
                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                __pyx_t_20.__pyx_n = 1;
                __pyx_t_20.exception = __pyx_v_e;
                __pyx_t_1 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_17, __pyx_v_val_type, __pyx_v_annotated_type, &__pyx_t_20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L85_error)
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
                __pyx_r = ((PyObject*)__pyx_t_1);
                __pyx_t_1 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                goto __pyx_L84_return;
              }

    +661:             ftype = field.type

          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_field, __pyx_n_s_type_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 661, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_v_ftype = __pyx_t_8;
          __pyx_t_8 = 0;

    +662:             if ftype <> val_type:

          __pyx_t_8 = PyObject_RichCompare(__pyx_v_ftype, __pyx_v_val_type, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 662, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (__pyx_t_2) {
    /* … */
          }

    +663:                 return _create_error(

            __Pyx_XDECREF(__pyx_r);
    /* … */
            __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_14, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 663, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_r = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
            goto __pyx_L0;

     664:                     name,

     665:                     value,

    +666:                     f"Invalid type for {annotated_type}.{name}, expected {ftype}",

            __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 666, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_16 = 0;
            __pyx_t_11 = 127;
            __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
            __pyx_t_16 += 17;
            __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
            __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 666, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u__11);
            __pyx_t_16 += 1;
            __Pyx_GIVEREF(__pyx_kp_u__11);
            PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
            __pyx_t_14 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 666, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_14);
            __pyx_t_14 = 0;
            __Pyx_INCREF(__pyx_kp_u_expected);
            __pyx_t_16 += 11;
            __Pyx_GIVEREF(__pyx_kp_u_expected);
            PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected);
            __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_ftype, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 666, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
            __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 666, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     667:                     val_type,

     668:                     annotated_type

     669:                 )

     670:         else:

     671:             # Validate primary key

    +672:             pk_field = get_primary_key_field(annotated_type, name, field_meta)

        /*else*/ {
          __pyx_t_8 = __pyx_f_9datamodel_10validation_get_primary_key_field(__pyx_v_annotated_type, __pyx_v_name, __pyx_v_field_meta); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 672, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_v_pk_field = __pyx_t_8;
          __pyx_t_8 = 0;

    +673:             if pk_field:

          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pk_field); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 673, __pyx_L1_error)
          if (__pyx_t_2) {
    /* … */
          }
        }
        __pyx_L72:;

    +674:                 pk_type = pk_field.type

            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_pk_field, __pyx_n_s_type_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 674, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_v_pk_type = __pyx_t_8;
            __pyx_t_8 = 0;

    +675:                 if not isinstance(value, pk_type):

            __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_v_pk_type); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 675, __pyx_L1_error)
            __pyx_t_19 = (!__pyx_t_2);
            if (__pyx_t_19) {
    /* … */
            }

    +676:                     return _create_error(

              __Pyx_XDECREF(__pyx_r);
    /* … */
              __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_pk_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 676, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __pyx_r = ((PyObject*)__pyx_t_8);
              __pyx_t_8 = 0;
              goto __pyx_L0;

     677:                         name,

     678:                         value,

    +679:                         f"Invalid type for {annotated_type}.{pk_field.name}, expected {pk_type}",

              __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 679, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_16 = 0;
              __pyx_t_11 = 127;
              __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
              __pyx_t_16 += 17;
              __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
              PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
              __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 679, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_11;
              __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
              __Pyx_GIVEREF(__pyx_t_14);
              PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_14);
              __pyx_t_14 = 0;
              __Pyx_INCREF(__pyx_kp_u__11);
              __pyx_t_16 += 1;
              __Pyx_GIVEREF(__pyx_kp_u__11);
              PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
              __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_pk_field, __pyx_n_s_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 679, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_14, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
              __pyx_t_4 = 0;
              __Pyx_INCREF(__pyx_kp_u_expected);
              __pyx_t_16 += 11;
              __Pyx_GIVEREF(__pyx_kp_u_expected);
              PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected);
              __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_pk_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
              __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_4);
              __pyx_t_4 = 0;
              __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     680:                         val_type,

     681:                         pk_type

     682:                     )

    +683:     elif is_optional_type(annotated_type):

      __pyx_t_19 = __pyx_f_9datamodel_10validation_is_optional_type(__pyx_v_annotated_type, 0); if (unlikely(__pyx_t_19 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 683, __pyx_L1_error)
      if (__pyx_t_19) {
    /* … */
        goto __pyx_L19;
      }

    +684:         inner_types = get_args(annotated_type)

        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_14 = NULL;
        __pyx_t_9 = 0;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_9 = 1;
          }
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_v_annotated_type};
          __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 684, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_v_inner_types = __pyx_t_8;
        __pyx_t_8 = 0;

    +685:         for t in inner_types:

        if (likely(PyList_CheckExact(__pyx_v_inner_types)) || PyTuple_CheckExact(__pyx_v_inner_types)) {
          __pyx_t_8 = __pyx_v_inner_types; __Pyx_INCREF(__pyx_t_8);
          __pyx_t_16 = 0;
          __pyx_t_13 = NULL;
        } else {
          __pyx_t_16 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_inner_types); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 685, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 685, __pyx_L1_error)
        }
        for (;;) {
          if (likely(!__pyx_t_13)) {
            if (likely(PyList_CheckExact(__pyx_t_8))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 685, __pyx_L1_error)
                #endif
                if (__pyx_t_16 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_4); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 685, __pyx_L1_error)
              #else
              __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              #endif
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 685, __pyx_L1_error)
                #endif
                if (__pyx_t_16 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_4); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 685, __pyx_L1_error)
              #else
              __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              #endif
            }
          } else {
            __pyx_t_4 = __pyx_t_13(__pyx_t_8);
            if (unlikely(!__pyx_t_4)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 685, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_4);
          }
          __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
          __pyx_t_4 = 0;
    /* … */
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L99_for_else;
        __pyx_L95_break:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L100_for_end;
        /*else*/ {
          __pyx_L99_for_else:;

    +686:             if t is type(None) and value is None:

          __pyx_t_2 = (__pyx_v_t == ((PyObject *)Py_TYPE(Py_None)));
          if (__pyx_t_2) {
          } else {
            __pyx_t_19 = __pyx_t_2;
            goto __pyx_L97_bool_binop_done;
          }
          __pyx_t_2 = (__pyx_v_value == Py_None);
          __pyx_t_19 = __pyx_t_2;
          __pyx_L97_bool_binop_done:;
          if (__pyx_t_19) {
    /* … */
          }

    +687:                 break

            goto __pyx_L95_break;

    +688:             elif is_instanceof(val_type, t):

          if (!(likely(PyType_CheckExact(__pyx_v_t))||((__pyx_v_t) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_v_t))) __PYX_ERR(0, 688, __pyx_L1_error)
          __pyx_t_19 = __pyx_f_9datamodel_10validation_is_instanceof(__pyx_v_val_type, ((PyTypeObject*)__pyx_v_t)); if (unlikely(__pyx_t_19 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 688, __pyx_L1_error)
          if (__pyx_t_19) {
    /* … */
          }

    +689:                 break

            goto __pyx_L95_break;

    +690:             elif val_type == t:

          __pyx_t_4 = PyObject_RichCompare(__pyx_v_val_type, __pyx_v_t, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error)
          __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 690, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_19) {
    /* … */
          }

    +691:                 break

            goto __pyx_L95_break;

     692:         else:

    +693:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 693, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L0;
        }
        __pyx_L100_for_end:;

     694:                 name,

     695:                 value,

    +696:                 f"Invalid type for {annotated_type}.{name}, expected one of {inner_types}",

          __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_16 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
          __pyx_t_16 += 17;
          __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
          __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __Pyx_INCREF(__pyx_kp_u__11);
          __pyx_t_16 += 1;
          __Pyx_GIVEREF(__pyx_kp_u__11);
          PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
          __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
          __pyx_t_4 = 0;
          __Pyx_INCREF(__pyx_kp_u_expected_one_of);
          __pyx_t_16 += 18;
          __Pyx_GIVEREF(__pyx_kp_u_expected_one_of);
          PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected_one_of);
          __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_inner_types, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     697:                 val_type,

     698:                 annotated_type

     699:             )

    +700:     elif val_type != annotated_type:

      __pyx_t_8 = PyObject_RichCompare(__pyx_v_val_type, __pyx_v_annotated_type, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 700, __pyx_L1_error)
      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_19) {
    /* … */
      }
      __pyx_L19:;

    +701:         instance = is_instanceof(value, annotated_type)

        if (!(likely(PyType_CheckExact(__pyx_v_annotated_type))||((__pyx_v_annotated_type) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_v_annotated_type))) __PYX_ERR(0, 701, __pyx_L1_error)
        __pyx_t_19 = __pyx_f_9datamodel_10validation_is_instanceof(__pyx_v_value, ((PyTypeObject*)__pyx_v_annotated_type)); if (unlikely(__pyx_t_19 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 701, __pyx_L1_error)
        __pyx_v_instance = __pyx_t_19;

    +702:         if not instance:

        __pyx_t_19 = (!__pyx_v_instance);
        if (__pyx_t_19) {
    /* … */
        }

    +703:             return _create_error(

          __Pyx_XDECREF(__pyx_r);
    /* … */
          __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(__pyx_v_name, __pyx_v_value, __pyx_t_4, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 703, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = ((PyObject*)__pyx_t_8);
          __pyx_t_8 = 0;
          goto __pyx_L0;

     704:                 name,

     705:                 value,

    +706:                 f"Invalid Instance for {annotated_type}.{name}, expected {annotated_type}",

          __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 706, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_16 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_Invalid_Instance_for);
          __pyx_t_16 += 21;
          __Pyx_GIVEREF(__pyx_kp_u_Invalid_Instance_for);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_Instance_for);
          __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __Pyx_INCREF(__pyx_kp_u__11);
          __pyx_t_16 += 1;
          __Pyx_GIVEREF(__pyx_kp_u__11);
          PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
          __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
          __pyx_t_4 = 0;
          __Pyx_INCREF(__pyx_kp_u_expected);
          __pyx_t_16 += 11;
          __Pyx_GIVEREF(__pyx_kp_u_expected);
          PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected);
          __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
          __pyx_t_16 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_16, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     707:                 val_type,

     708:                 annotated_type

     709:             )

    +710:     return error

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_error);
      __pyx_r = __pyx_v_error;
      goto __pyx_L0;

     711:

     712: # Define a validator function for uint64

    +713: def validate_uint64(value: int) -> None:

    /* Python wrapper */
    static PyObject *__pyx_pw_9datamodel_10validation_5validate_uint64(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_9datamodel_10validation_4validate_uint64, "validate_uint64(int value: int) -> None\nValidate uint64 values.\n    ");
    static PyMethodDef __pyx_mdef_9datamodel_10validation_5validate_uint64 = {"validate_uint64", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_10validation_5validate_uint64, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_10validation_4validate_uint64};
    static PyObject *__pyx_pw_9datamodel_10validation_5validate_uint64(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_value = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("validate_uint64 (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_MACROS
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0};
      PyObject* values[1] = {0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
              (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
              kw_args--;
            }
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "validate_uint64") < 0)) __PYX_ERR(0, 713, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        }
        __pyx_v_value = ((PyObject*)values[0]);
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("validate_uint64", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 713, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      {
        Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
          __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
        }
      }
      __Pyx_AddTraceback("datamodel.validation.validate_uint64", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_value), (&PyInt_Type), 0, "value", 1))) __PYX_ERR(0, 713, __pyx_L1_error)
      __pyx_r = __pyx_pf_9datamodel_10validation_4validate_uint64(__pyx_self, __pyx_v_value);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      {
        Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
          __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
        }
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_9datamodel_10validation_4validate_uint64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("datamodel.validation.validate_uint64", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_value); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__25);
      __Pyx_GIVEREF(__pyx_tuple__25);
    /* … */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_value, __pyx_n_s_int) < 0) __PYX_ERR(0, 713, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_None) < 0) __PYX_ERR(0, 713, __pyx_L1_error)
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9datamodel_10validation_5validate_uint64, 0, __pyx_n_s_validate_uint64, NULL, __pyx_n_s_datamodel_validation, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_validate_uint64, __pyx_t_4) < 0) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     714:     """Validate uint64 values.

     715:     """

    +716:     if value < uint64_min or value > uint64_max:

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint64_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_4) {
      } else {
        __pyx_t_1 = __pyx_t_4;
        goto __pyx_L4_bool_binop_done;
      }
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint64_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __pyx_t_4;
      __pyx_L4_bool_binop_done:;
      if (unlikely(__pyx_t_1)) {
    /* … */
      }

    +717:         raise ValueError(f"{value} is not a valid uint64")

        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_2, __pyx_kp_u_is_not_a_valid_uint64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 717, __pyx_L1_error)

     718:

    +719: cdef dict validate_type(object F, object name, object value, object annotated_type, object val_type):

    static PyObject *__pyx_f_9datamodel_10validation_validate_type(PyObject *__pyx_v_F, PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_annotated_type, PyObject *__pyx_v_val_type) {
      PyObject *__pyx_v_inner_types = NULL;
      PyObject *__pyx_v_allowed = NULL;
      PyObject *__pyx_v_expected = NULL;
      PyObject *__pyx_8genexpr2__pyx_v_t = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_AddTraceback("datamodel.validation.validate_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_inner_types);
      __Pyx_XDECREF(__pyx_v_allowed);
      __Pyx_XDECREF(__pyx_v_expected);
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     720:     """

     721:     Validate that 'value' is of type 'annotated_type'.

     722:     If 'annotated_type' is a Union, checks if 'value' is an instance of any of the union types.

     723:     Returns None if valid; otherwise, returns an error object via _create_error.

     724:     """

    +725:     if not isinstance(value, type):

      __pyx_t_1 = PyType_Check(__pyx_v_value);
      __pyx_t_2 = (!__pyx_t_1);
      if (__pyx_t_2) {
    /* … */
      }

    +726:         return _create_error(name, value, f'Invalid type for {annotated_type}.{name}, expected a type', val_type, annotated_type)

        __Pyx_XDECREF(__pyx_r);
        if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 726, __pyx_L1_error)
        __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_5 = 127;
        __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
        __pyx_t_4 += 17;
        __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Invalid_type_for);
        __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u__11);
        __pyx_t_4 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__11);
        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__11);
        __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_a_type);
        __pyx_t_4 += 17;
        __Pyx_GIVEREF(__pyx_kp_u_expected_a_type);
        PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_expected_a_type);
        __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_v_name), __pyx_v_value, __pyx_t_6, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 726, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_r = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;
        goto __pyx_L0;

    +727:     inner_types = get_args(F.args[0])

      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_9 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_9 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 727, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_v_inner_types = __pyx_t_3;
      __pyx_t_3 = 0;

    +728:     for allowed in inner_types:

      if (likely(PyList_CheckExact(__pyx_v_inner_types)) || PyTuple_CheckExact(__pyx_v_inner_types)) {
        __pyx_t_3 = __pyx_v_inner_types; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_inner_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 728, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 728, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 728, __pyx_L1_error)
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_MACROS
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 728, __pyx_L1_error)
              #endif
              if (__pyx_t_4 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 728, __pyx_L1_error)
            #else
            __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          }
        } else {
          __pyx_t_6 = __pyx_t_10(__pyx_t_3);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 728, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_v_allowed, __pyx_t_6);
        __pyx_t_6 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +729:         if value is allowed:

        __pyx_t_2 = (__pyx_v_value == __pyx_v_allowed);
        if (__pyx_t_2) {
    /* … */
        }

    +730:             return {}

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 730, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_r = ((PyObject*)__pyx_t_6);
          __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L0;

    +731:     expected = ', '.join([str(t) for t in F.args])

      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 731, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_args_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 731, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
          __pyx_t_8 = __pyx_t_6; __Pyx_INCREF(__pyx_t_8);
          __pyx_t_4 = 0;
          __pyx_t_10 = NULL;
        } else {
          __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 731, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 731, __pyx_L10_error)
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        for (;;) {
          if (likely(!__pyx_t_10)) {
            if (likely(PyList_CheckExact(__pyx_t_8))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 731, __pyx_L10_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_6 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 731, __pyx_L10_error)
              #else
              __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 731, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_6);
              #endif
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 731, __pyx_L10_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 731, __pyx_L10_error)
              #else
              __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 731, __pyx_L10_error)
              __Pyx_GOTREF(__pyx_t_6);
              #endif
            }
          } else {
            __pyx_t_6 = __pyx_t_10(__pyx_t_8);
            if (unlikely(!__pyx_t_6)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 731, __pyx_L10_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_6);
          }
          __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_t, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_8genexpr2__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 731, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 731, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t); __pyx_8genexpr2__pyx_v_t = 0;
        goto __pyx_L14_exit_scope;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t); __pyx_8genexpr2__pyx_v_t = 0;
        goto __pyx_L1_error;
        __pyx_L14_exit_scope:;
      } /* exit inner scope */
      __pyx_t_8 = PyUnicode_Join(__pyx_kp_u__18, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_expected = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;

    +732:     return _create_error(name, value, f'Invalid type for {annotated_type}.{name}, expected a type of {expected}', val_type, annotated_type)

      __Pyx_XDECREF(__pyx_r);
      if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 732, __pyx_L1_error)
      __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_Invalid_type_for);
      __pyx_t_4 += 17;
      __Pyx_GIVEREF(__pyx_kp_u_Invalid_type_for);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Invalid_type_for);
      __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_kp_u__11);
      __pyx_t_4 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__11);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__11);
      __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_kp_u_expected_a_type_of);
      __pyx_t_4 += 21;
      __Pyx_GIVEREF(__pyx_kp_u_expected_a_type_of);
      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_expected_a_type_of);
      __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_expected); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_8, 6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_v_name), __pyx_v_value, __pyx_t_3, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;
      goto __pyx_L0;

     733:

    +734: cdef dict validate_enum(object name, object value, object annotated_type, object val_type):

    static PyObject *__pyx_f_9datamodel_10validation_validate_enum(PyObject *__pyx_v_name, PyObject *__pyx_v_value, PyObject *__pyx_v_annotated_type, PyObject *__pyx_v_val_type) {
      PyObject *__pyx_v_val = 0;
      PyObject *__pyx_v_enum_values = 0;
      PyObject *__pyx_8genexpr3__pyx_v_e = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_AddTraceback("datamodel.validation.validate_enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_val);
      __Pyx_XDECREF(__pyx_v_enum_values);
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_e);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     735:     """

     736:     Validate that 'value' is a valid member of the enum 'annotated_type'.

     737:     If 'value' is an instance of 'annotated_type', use its .value.

     738:     Cache the allowed enum values on the enum type to avoid repeated introspection.

     739:     Returns None if valid; otherwise, returns an error object via _create_error.

     740:     """

    +741:     cdef object val = value.value if PyObject_IsInstance(value, annotated_type) else value

      __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_v_annotated_type); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 741, __pyx_L1_error)
      if (__pyx_t_2) {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(__pyx_v_value);
        __pyx_t_1 = __pyx_v_value;
      }
      __pyx_v_val = __pyx_t_1;
      __pyx_t_1 = 0;

    +742:     cdef object enum_values = [e.value for e in annotated_type]

      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (likely(PyList_CheckExact(__pyx_v_annotated_type)) || PyTuple_CheckExact(__pyx_v_annotated_type)) {
          __pyx_t_3 = __pyx_v_annotated_type; __Pyx_INCREF(__pyx_t_3);
          __pyx_t_4 = 0;
          __pyx_t_5 = NULL;
        } else {
          __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_annotated_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 742, __pyx_L5_error)
        }
        for (;;) {
          if (likely(!__pyx_t_5)) {
            if (likely(PyList_CheckExact(__pyx_t_3))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 742, __pyx_L5_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 742, __pyx_L5_error)
              #else
              __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 742, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_6);
              #endif
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
                #if !CYTHON_ASSUME_SAFE_MACROS
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 742, __pyx_L5_error)
                #endif
                if (__pyx_t_4 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 742, __pyx_L5_error)
              #else
              __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 742, __pyx_L5_error)
              __Pyx_GOTREF(__pyx_t_6);
              #endif
            }
          } else {
            __pyx_t_6 = __pyx_t_5(__pyx_t_3);
            if (unlikely(!__pyx_t_6)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 742, __pyx_L5_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_6);
          }
          __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_e, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr3__pyx_v_e, __pyx_n_s_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 742, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 742, __pyx_L5_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_e); __pyx_8genexpr3__pyx_v_e = 0;
        goto __pyx_L9_exit_scope;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_e); __pyx_8genexpr3__pyx_v_e = 0;
        goto __pyx_L1_error;
        __pyx_L9_exit_scope:;
      } /* exit inner scope */
      __pyx_v_enum_values = __pyx_t_1;
      __pyx_t_1 = 0;

    +743:     if val not in enum_values:

      __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_val, __pyx_v_enum_values, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 743, __pyx_L1_error)
      if (__pyx_t_2) {
    /* … */
      }

    +744:         return _create_error(

        __Pyx_XDECREF(__pyx_r);
    /* … */
        __pyx_t_1 = __pyx_f_9datamodel_10validation__create_error(((PyObject*)__pyx_v_name), __pyx_v_value, __pyx_t_3, __pyx_v_val_type, __pyx_v_annotated_type, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L0;

    +745:             name, value, f"Invalid value for {annotated_type}.{name}, expected one of {enum_values}", val_type, annotated_type

        if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 745, __pyx_L1_error)
        __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = 0;
        __pyx_t_7 = 127;
        __Pyx_INCREF(__pyx_kp_u_Invalid_value_for);
        __pyx_t_4 += 18;
        __Pyx_GIVEREF(__pyx_kp_u_Invalid_value_for);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Invalid_value_for);
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_annotated_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_INCREF(__pyx_kp_u__11);
        __pyx_t_4 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__11);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__11);
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_INCREF(__pyx_kp_u_expected_one_of);
        __pyx_t_4 += 18;
        __Pyx_GIVEREF(__pyx_kp_u_expected_one_of);
        PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_expected_one_of);
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_enum_values, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
        __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     746:         )

    +747:     return {}

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;