Your IP : 18.221.11.104


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/__pycache__/json_schema.cpython-311.pyc

�

�&fN����UdZddlmZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlZdd	lm Z m!Z!m"Z"m#Z#dd
l$m%Z%ddl&m'Z'm(Z(m)Z)dd
l*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8m9Z9er ddl:m;Z;ddl<m=Z=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDe(e"jEe"jFfZG	eeHefZI	e(dZJ	ddd�ZKdeLd<d\d �ZMe(d!ZN	Gd"�d#eO��ZPd$ZQ	ed%eH��ZRed&eH��ZSed'eH��ZTeeReJfZUed(e�)��ZVejWd]ie/jX��Gd*�d+����ZYGd,�d-��ZZd.eQeZd/fd^d:�Z[d.ddeQeZd;�d_dB�Z\eeeHefeeeHe]e^e_dfZ`eeHe`fZaeeeeHefdCfeedCfeHe]e^e_dfZbd`dG�ZcdadK�ZddbdcdM�ZeejWd]ie/jX��GdN�dO����ZfejWd]ie/jX��GdP�dQ����ZgdddU�ZhedV��Ziere'eidCfZjn%ejWd]ie/jX��GdW�dX����Zjded[�ZkdS)fag
The `json_schema` module contains classes and functions to allow the way [JSON Schema](https://json-schema.org/)
is generated to be customized.

In general you shouldn't need to use this module directly; instead, you can
[`BaseModel.model_json_schema`][pydantic.BaseModel.model_json_schema] and
[`TypeAdapter.json_schema`][pydantic.TypeAdapter.json_schema].
�)�annotationsN)�defaultdict)�deepcopy)�is_dataclass)�Enum)�
TYPE_CHECKING�Any�Callable�Counter�Dict�Hashable�Iterable�List�NewType�Sequence�Tuple�TypeVar�Union�cast)�
CoreSchema�PydanticOmit�core_schema�to_jsonable_python)�
ComputedField)�	Annotated�Literal�assert_never�)�_config�_core_metadata�_core_utils�_decorators�_internal_dataclass�
_mock_val_ser�_schema_generation_shared�
_typing_extra)�GetJsonSchemaHandler)�JsonSchemaExtraCallable)�PydanticInvalidForJsonSchema�PydanticUserError)�
ConfigDict)�CoreSchemaField�CoreSchemaOrField)�PydanticDataclass)�GetJsonSchemaFunction)�	BaseModel)�
validation�
serialization�Input�Outputzdict[JsonSchemaMode, str]�_MODE_TITLE_MAPPING�schema�JsonSchemaValue�updates�dict[str, Any]�returnc�0�|�|��|S)aNUpdate a JSON schema by providing a dictionary of updates.

    This function sets the provided key-value pairs in the schema and returns the updated schema.

    Args:
        schema: The JSON schema to update.
        updates: A dictionary of key-value pairs to set in the schema.

    Returns:
        The updated JSON schema.
    )�update)r6r8s  �I/opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/json_schema.py�update_json_schemar>Ys���M�M�'�����M�)�skipped-choice�non-serializable-defaultc��eZdZdZdS)�PydanticJsonSchemaWarningaThis class is used to emit warnings produced during JSON schema generation.
    See the [`GenerateJsonSchema.emit_warning`][pydantic.json_schema.GenerateJsonSchema.emit_warning] and
    [`GenerateJsonSchema.render_warning_message`][pydantic.json_schema.GenerateJsonSchema.render_warning_message]
    methods for more details; these can be overridden to control warning behavior.
    N)�__name__�
__module__�__qualname__�__doc__�r?r=rCrCrs���������r?rCz#/$defs/{model}�CoreRef�DefsRef�JsonRef�JsonSchemaKeyT)�boundc�T�eZdZUded<ded<edd���Zdd�Zdd�Zdd�ZdS)�_DefinitionsRemappingzdict[DefsRef, DefsRef]�defs_remappingzdict[JsonRef, JsonRef]�json_remapping�prioritized_choices�dict[DefsRef, list[DefsRef]]�defs_to_json�dict[DefsRef, JsonRef]�definitions�dict[DefsRef, JsonSchemaValue]r:c�H��t|��}d|i}td��D]�}tt���|D]0}||}|D]#}�|�||���$�1����D]\}}	t
�|���|<�i}
i}|D];}||}t�fd�|D����}
|
|
|<||
|||<�<t|
|��}|�	d|i��}||kr|cS|}��td���)z�
        This function should produce a remapping that replaces complex DefsRef with the simpler ones from the
        prioritized_choices such that applying the name remapping would result in an equivalent JSON schema.
        �$defs�dc3�N�K�|]}t�|��dk�|V�� dS)rN)�len)�.0�x�schemas_for_alternativess  �r=�	<genexpr>zA_DefinitionsRemapping.from_prioritized_choices.<locals>.<genexpr>�s=�����(j�(j�q�C�H`�ab�Hc�Dd�Dd�hi�Di�Di��Di�Di�Di�Di�(j�(jr?z.Failed to simplify the JSON schema definitions)r�ranger�list�append�items�_deduplicate_schemas�nextrO�remap_json_schemar))rRrTrV�copied_definitions�definitions_schema�_iter�defs_ref�alternatives�alternative�schemasrPrQ�original_defs_ref�remapped_defs_ref�	remapping�new_definitions_schemar_s                @r=�from_prioritized_choicesz._DefinitionsRemapping.from_prioritized_choices�s����&�k�2�2��%�'9�:���3�Z�Z�	8�	8�E�MX�Y]�M^�M^�$�.�
_�
_��2�8�<��#/�_�_�K�,�[�9�@�@�AS�T\�A]�^�^�^�^�_�
&>�%C�%C�%E�%E�
n�
n�!��'�5I�Jb�ck�Jl�5m�5m�(��2�2�68�N�57�N�%0�
b�
b�!�2�3D�E��$(�(j�(j�(j�(j�L�(j�(j�(j�$j�$j�!�4E��0�1�BN�O`�Ba��|�,=�>�?�?�-�n�n�M�M�I�%.�%@�%@�'�K]�A^�%_�%_�"�!�%;�;�;� � � � �!7���*�+[�\�\�\r?�refrJc�8�|j�||��S�N)rP�get��selfrts  r=�remap_defs_refz$_DefinitionsRemapping.remap_defs_ref�����"�&�&�s�C�0�0�0r?rKc�8�|j�||��Srv)rQrwrxs  r=�remap_json_refz$_DefinitionsRemapping.remap_json_ref�r{r?r6r	c�,��t|t��r"��t|����St|t��r�fd�|D��St|t
��r�|���D]�\}}|dkr;t|t��r&��t|����|d<�F|dkr*�fd�|d���D��|d<�v��|��||<��|S)zH
        Recursively update the JSON schema replacing all $refs
        c�:��g|]}��|����SrH)rg�r]�itemrys  �r=�
<listcomp>z;_DefinitionsRemapping.remap_json_schema.<locals>.<listcomp>�s'���D�D�D�T�D�*�*�4�0�0�D�D�Dr?�$refrYc���i|];\}}��t|������|����<SrH)rzrJrg)r]�key�valuerys   �r=�
<dictcomp>z;_DefinitionsRemapping.remap_json_schema.<locals>.<dictcomp>�sR���'�'�'�&�C���+�+�G�C�L�L�9�9�4�;Q�;Q�RW�;X�;X�'�'�'r?)�
isinstance�strr}rKrb�dictrdrg)ryr6r�r�s`   r=rgz'_DefinitionsRemapping.remap_json_schema�s,����f�c�"�"�	@��&�&�w�v���7�7�7�
���
%�
%�	@�D�D�D�D�V�D�D�D�D�
���
%�
%�
	@�$�l�l�n�n�	
@�	
@�
��U��&�=�=�Z��s�%;�%;�=�%)�%8�%8�����%H�%H�F�6�N�N��G�^�^�'�'�'�'�*0��/�*?�*?�*A�*A�'�'�'�F�7�O�O�
#'�"8�"8��"?�"?�F�3�K�K��
r?N)rRrSrTrUrVrWr:rO)rtrJr:rJ)rtrKr:rK)r6r	r:r	)	rDrErF�__annotations__�staticmethodrsrzr}rgrHr?r=rOrO�s��������*�*�*�*�*�*�*�*��,]�,]�,]��\�,]�\1�1�1�1�1�1�1�1������r?rOc��eZdZUdZdZdhZded<defd�d�Ze	d�d���Z
e	d�d���Zd�d�Zd�d�Z
d�d�d�Zd�d�Zd�d �Zd�d"�Zd�d$�Zd�d&�Zd�d(�Zd�d*�Zd�d,�Zd�d.�Zd�d0�Zd�d2�Zd�d4�Zd�d6�Zd�d8�Zd�d:�Zd�d<�Zd�d>�Zd�d@�Z d�dB�Z!d�dD�Z"d�dF�Z#d�dH�Z$d�dJ�Z%d�dL�Z&d�dN�Z'd�dP�Z(d�dR�Z)�ddT�Z*�ddV�Z+�ddX�Z,�ddZ�Z-�dd\�Z.�dd^�Z/�dd`�Z0�ddd�Z1�ddf�Z2�d	dh�Z3�d
dj�Z4�ddl�Z5e6�ddp���Z7�d
ds�Z8�ddw�Z9�ddy�Z:�dd{�Z;�dd}�Z<�dd�Z=�dd��Z>�dd��Z?�dd��Z@�dd��ZA�dd��ZB�dd��ZC�dd��ZD�dd��ZE�dd��ZF�dd��ZG�dd��ZH�dd��ZI�dd��ZJ�d d��ZK�d!d��ZL�d"d��ZM�d#d��ZN�d$d��ZO�d%d��ZP�d&d��ZQ�d'd��ZR�d(d��ZS�d)d��ZT�d(d��ZU�d*d��ZV�d+d��ZW�dd��ZX�d,dÄZY�d-dƄZZ�d.d˄Z[Gd̄dͦ�Z\�d/dЄZ]�d0d҄Z^�d1dԄZ_�d2d؄Z`�d3dلZa�d4dۄZb�d5d܄Zcd�S(6�GenerateJsonSchemaa�A class for generating JSON schemas.

    This class generates JSON schemas based on configured parameters. The default schema dialect
    is [https://json-schema.org/draft/2020-12/schema](https://json-schema.org/draft/2020-12/schema).
    The class uses `by_alias` to configure how fields with
    multiple names are handled and `ref_template` to format reference names.

    Attributes:
        schema_dialect: The JSON schema dialect used to generate the schema. See
            [Declaring a Dialect](https://json-schema.org/understanding-json-schema/reference/schema.html#id4)
            in the JSON Schema documentation for more information about dialects.
        ignored_warning_kinds: Warnings to ignore when generating the schema. `self.render_warning_message` will
            do nothing if its argument `kind` is in `ignored_warning_kinds`;
            this value can be modified on subclasses to easily control which warnings are emitted.
        by_alias: Whether or not to use field names when generating the schema.
        ref_template: The format string used when generating reference names.
        core_to_json_refs: A mapping of core refs to JSON refs.
        core_to_defs_refs: A mapping of core refs to definition refs.
        defs_to_core_refs: A mapping of definition refs to core refs.
        json_to_defs_refs: A mapping of JSON refs to definition refs.
        definitions: Definitions in the schema.
        collisions: Definitions with colliding names. When collisions are detected, we choose a non-colliding
            name during generation, but we also track the colliding tag so that it can be remapped for the first
            occurrence at the end of the process.
        defs_ref_fallbacks: Core refs to fallback definitions refs.
        _schema_type_to_method: A mapping of schema types to generator methods.
        _used: Set to `True` after generating a schema to avoid re-use issues.
        mode: The schema mode.

    Args:
        by_alias: Whether or not to include field names.
        ref_template: The format string to use when generating reference names.

    Raises:
        JsonSchemaError: If the instance of the class is inadvertently re-used after generating a schema.
    z,https://json-schema.org/draft/2020-12/schemar@zset[JsonSchemaWarningKind]�ignored_warning_kindsT�by_alias�bool�ref_templater�c�h�||_||_i|_i|_i|_i|_i|_tjtj	i����|_
d|_i|_tt��|_i|_|���|_i|_d|_dS)Nr1F)r�r��core_to_json_refs�core_to_defs_refs�defs_to_core_refs�json_to_defs_refsrVr�ConfigWrapperStack�
ConfigWrapper�_config_wrapper_stack�_mode�_prioritized_defsref_choicesr�int�_collision_counter�_collision_index�build_schema_type_to_method�_schema_type_to_method�"_core_defs_invalid_for_json_schema�_used)ryr�r�s   r=�__init__zGenerateJsonSchema.__init__s��� ��
�(���=?���=?���=?���9;���;=���%,�%?��@U�VX�@Y�@Y�%Z�%Z��"�%1��
�KM��)�2=�c�2B�2B���02���&*�&F�&F�&H�&H��#�`b��/���
�
�
r?r:�_config.ConfigWrapperc��|jjSrv)r��tail�rys r=rzGenerateJsonSchema._config/s���)�.�.r?�JsonSchemaModec�@�|jj�|jjS|jSrv)r�json_schema_mode_overrider�r�s r=�modezGenerateJsonSchema.mode3s ���<�1�=��<�9�9��:�r?�Kdict[CoreSchemaOrFieldType, Callable[[CoreSchemaOrField], JsonSchemaValue]]c��i}tjt��}|D]m}|�dd���d�}	t	||��||<�0#t
$r1}t
d|�dt|��j�d|�d���|�d}~wwxYw|S)	aOBuilds a dictionary mapping fields to methods for generating JSON schemas.

        Returns:
            A dictionary containing the mapping of `CoreSchemaOrFieldType` to a handler method.

        Raises:
            TypeError: If no method has been defined for generating a JSON schema for a given pydantic core schema type.
        �-�_�_schemaz9No method for generating JsonSchema for core_schema.type=z (expected: �.�)N)	r&�all_literal_values�CoreSchemaOrFieldType�replace�getattr�AttributeError�	TypeError�typerD)ry�mapping�core_schema_typesr��method_name�es      r=r�z.GenerateJsonSchema.build_schema_type_to_method:s���`b��9F�9Y�!�:
�:
��%�	�	�C� �[�[��c�2�2�;�;�;�K�
�&�t�[�9�9������!�
�
�
��G�PS�G�G�"&�t�*�*�"5�G�G�8C�G�G�G���������
����
�s�A�
B	�,B�B	�inputs�GSequence[tuple[JsonSchemaKeyT, JsonSchemaMode, core_schema.CoreSchema]]�ctuple[dict[tuple[JsonSchemaKeyT, JsonSchemaMode], JsonSchemaValue], dict[DefsRef, JsonSchemaValue]]c���|jr'tdt|��j�d�d����|D]"\}}}||_|�|���#|���}i}|D]<\}}}||_|�|��}|�|��|||f<�=d|ji}|�|��}d|_|t|d��fS)a�Generates JSON schema definitions from a list of core schemas, pairing the generated definitions with a
        mapping that links the input keys to the definition references.

        Args:
            inputs: A sequence of tuples, where:

                - The first element is a JSON schema key type.
                - The second element is the JSON mode: either 'validation' or 'serialization'.
                - The third element is a core schema.

        Returns:
            A tuple where:

                - The first element is a dictionary whose keys are tuples of JSON schema key type and JSON mode, and
                    whose values are the JSON schema corresponding to that pair of inputs. (These schemas may have
                    JsonRef references to definitions that are defined in the second returned element.)
                - The second element is a dictionary whose keys are definition references for the JSON schemas
                    from the first returned element, and whose values are the actual JSON schema definitions.

        Raises:
            PydanticUserError: Raised if the JSON schema generator has already been used to generate a JSON schema.
        �nThis JSON schema generator has already been used to generate a JSON schema. You must create a new instance of � to generate a new JSON schema.�json-schema-already-used��coderYT)
r�r*r�rDr��generate_inner�_build_definitions_remappingrgrV�_sort_json_schema)ryr�r�r�r6�definitions_remapping�json_schemas_map�json_schemas        r=�generate_definitionsz'GenerateJsonSchema.generate_definitionsTs-��2�:�	�#�j�59�$�Z�Z�5H�j�j�j�/����
�"(�	(�	(��C��v��D�J�����'�'�'�'� $� A� A� C� C��QS��!'�	a�	a��C��v��D�J��-�-�f�5�5�K�,A�,S�,S�T_�,`�,`��c�4�[�)�)��� 0�1��+�=�=�k�J�J����
��!2�;�w�3G�!H�!H�H�Hr?r1r6rr�r7c���||_|jr'tdt|��j�d�d����|�|��}|�|��}tt|�	d����}|�y|�
|��}||dks|�dd|igi}n$|���}||xxdzcc<tt|�	d����}|�y|�|��|�
��}|jr
|j|d	<|�|��}d
|_t!|��S)a�Generates a JSON schema for a specified schema in a specified mode.

        Args:
            schema: A Pydantic model.
            mode: The mode in which to generate the schema. Defaults to 'validation'.

        Returns:
            A JSON schema representing the specified schema.

        Raises:
            PydanticUserError: If the JSON schema generator has already been used to generate a JSON schema.
        r�r�r�r�r�Nr�allOfrYT)r�r�r*r�rDr��get_json_ref_countsrrKrw�get_schema_from_definitions�copy�_garbage_collect_definitionsr�rVrgr�)ryr6r�r��json_ref_countsrt�ref_json_schemar�s        r=�generatezGenerateJsonSchema.generate�s�����
��:�	�#�j�59�$�Z�Z�5H�j�j�j�/����
�(,�':�':�6�'B�'B���2�2�;�?�?���7�K�O�O�F�3�3�4�4���o�"�>�>�s�C�C�O��s�#�a�'�'�?�+B�&�&�#���8���.�2�2�4�4����$�$�$��)�$�$�$��w����� 7� 7�8�8�C��o�	
�)�)�+�6�6�6� $� A� A� C� C����	4�#'�#3�K�� �+�=�=�k�J�J����
� ��-�-�-r?r-c�|��
��d|vrJt|d��}|�jf}|�jvr#�j|�jvrd�j|iStj|��}d�fd��dd	��
d�
��fd�}tj�|��}|j	�
d
d��D] }||fd�fd�
}tj�|��}�!|j	�
dd��D]!}||fd�
�fd�
}tj�|��}�"||��}	tj|��r�||	��}	�
|	��}	|	S)z�Generates a JSON schema for a given core schema.

        Args:
            schema: The given core schema.

        Returns:
            The generated JSON schema.
        rtr�rrr�r7r:c�*��d|vr�t|d��}��|��\}}t|d��}|�j|<|�dd��|kr%|�j|<�j�|d��|}|S)Nrtr�)rI�get_cache_defs_ref_schemarKr�rwrVr��pop)rr��core_refrkr��json_refrys      �r=�
populate_defsz8GenerateJsonSchema.generate_inner.<locals>.populate_defs�s������#�#�"�;�u�#5�6�6��,0�,J�,J�8�,T�,T�)��/�"�?�6�#:�;�;��3;��&�x�0��?�?�6�4�0�0�H�<�<�1<�D�$�X�.��;�?�?��$�O�O�O�-���r?c��d|vrWt|�����dkr2|���}|�d��}dd|igi|�}|S)Nr�rr�)r\�keysr�r�)r�rts  r=�convert_to_all_ofz<GenerateJsonSchema.generate_inner.<locals>.convert_to_all_of�sj����$�$��[�-=�-=�-?�-?�)@�)@�1�)D�)D�*�.�.�0�0��!�o�o�f�-�-��&�&�#���G�;�G���r?�schema_or_fieldr-c�p��d}�jdkr!d|vr|d}��|��}|�Ytj|��stj|��r�j|d}||��}nt
d|�����tj|��r�||��}�|��}|S)a@Generate a JSON schema based on the input schema.

            Args:
                schema_or_field: The core schema to generate a JSON schema from.

            Returns:
                The generated JSON schema.

            Raises:
                TypeError: If an unexpected schema type is encountered.
            Nr2r��Unexpected schema type: schema=)r��
ser_schemar!�is_core_schema�is_core_schema_fieldr�r�)r�r�r��generate_for_schema_typer�r�rys    ���r=�handler_funcz7GenerateJsonSchema.generate_inner.<locals>.handler_func�s����37�K��y�O�+�+��?�0R�0R�,�_�=�
�"�o�o�j�9�9���"��-�o�>�>�Y�+�Bb�cr�Bs�Bs�Y�/3�/J�?�[a�Kb�/c�,�":�":�?�"K�"K�K�K�#�$W�o�$W�$W�X�X�X��)�/�:�:�
=�+�m�O�[�I�I��/�/��<�<���r?�pydantic_js_functionsrH�current_handlerr'�js_modify_functionr/c����|||��}tj|��r�||��}|�|��}|�dd��}|r|r|�|��|S)Nr�)r!r��resolve_ref_schemar�r<)r�r�r�r��original_schemartr�s      �r=�new_handler_funcz;GenerateJsonSchema.generate_inner.<locals>.new_handler_funcs����
1�0��/�R�R���-�o�>�>�N�"/�-���"M�"M�K�"1�"D�"D�[�"Q�"Q��!�o�o�f�d�3�3���8�;�8�#�*�*�;�7�7�7�&�&r?� pydantic_js_annotation_functionsc�v��|||��}tj|��r�||��}�|��}|Srv)r!r�)r�r�r�r�r�r�s    ��r=r�z;GenerateJsonSchema.generate_inner.<locals>.new_handler_funcsR���
1�0��/�R�R���-�o�>�>�A�"/�-���"M�"M�K�"3�"3�K�"@�"@�K�"�"r?)rrr�r7r:r7�r�r7r:r7)r�r-r:r7)r�r-r�r'r�r/r:r7)
rIr�r�rVr�r �CoreMetadataHandlerr%�GenerateJsonSchemaHandler�metadatarwr!r�)ryr6r��
core_mode_ref�metadata_handlerr�r�r�r�r�r�r�s`         @@r=r�z!GenerateJsonSchema.generate_inner�s������F�?�?��v�e�}�-�-�H�%�t�y�1�M��� 6�6�6�4�;Q�R_�;`�dh�dt�;t�;t��� 6�}� E�F�F�*�=�f�E�E��
	�
	�
	�
	�
	�
	�	�	�	�	�	�	�	�	�	�	�	�	�84�M�d�T`�a�a��"2�";�"?�"?�@W�Y[�"\�"\�	j�	j��9H�<N�
'�
'�
'�
'�
'�
'�
'�8�Q�RV�Xh�i�i�O�O�"2�";�"?�"?�@b�df�"g�"g�
	j�
	j��9H�<N�	
#�	
#�	
#�	
#�	
#�	
#�	
#�	
#�8�Q�RV�Xh�i�i�O�O�%�o�f�-�-���%�f�-�-�	9�'�-���<�<�K�+�+�K�8�8�K��r?�core_schema.AnySchemac��iS)z�Generates a JSON schema that matches any value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rH�ryr6s  r=�
any_schemazGenerateJsonSchema.any_schema,s	���	r?�core_schema.NoneSchemac�
�ddiS)z�Generates a JSON schema that matches a None value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r��nullrHr�s  r=�none_schemazGenerateJsonSchema.none_schema7s�����r?�core_schema.BoolSchemac�
�ddiS)z�Generates a JSON schema that matches a bool value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r��booleanrHr�s  r=�bool_schemazGenerateJsonSchema.bool_schemaBs���	�"�"r?�core_schema.IntSchemac��ddi}|�|||jj��d�|���D��}|S)z�Generates a JSON schema that matches an Int value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r��integerc�P�i|]#\}}|tjtjhv� ||��$SrH��math�inf�r]�k�vs   r=r�z1GenerateJsonSchema.int_schema.<locals>.<dictcomp>X�6��^�^�^���1�q���TX�T\�S\�H]�?]�?]�q�!�?]�?]�?]r?��update_with_validations�ValidationsMapping�numericrd�ryr6r�s   r=�
int_schemazGenerateJsonSchema.int_schemaMsQ��(.�y�&9���$�$�[�&�$�:Q�:Y�Z�Z�Z�^�^��(9�(9�(;�(;�^�^�^���r?�core_schema.FloatSchemac��ddi}|�|||jj��d�|���D��}|S)z�Generates a JSON schema that matches a float value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r��numberc�P�i|]#\}}|tjtjhv� ||��$SrHr	rs   r=r�z3GenerateJsonSchema.float_schema.<locals>.<dictcomp>frr?rrs   r=�float_schemazGenerateJsonSchema.float_schema[sQ��(.�x�&8���$�$�[�&�$�:Q�:Y�Z�Z�Z�^�^��(9�(9�(;�(;�^�^�^���r?�core_schema.DecimalSchemac
�n�|�tj����}|jdk�r|�d��}|�d��}|�d��}|�d��}|�d��}d|�tj|�d��|�d	nt|��|�d	nt|��|�d	nt|��|�d	nt|��|�d	nt|���
����|gi}|S)z�Generates a JSON schema that matches a decimal value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r1�multiple_of�le�ge�lt�gt�anyOf�
allow_inf_nanN)r#rrrr r!)�
str_schemarr�rwr�float)ryr6r�rrrr r!s        r=�decimal_schemaz!GenerateJsonSchema.decimal_schemais+���o�o�k�&<�&>�&>�?�?���9��$�$� �*�*�]�3�3�K����D�!�!�B����D�!�!�B����D�!�!�B����D�!�!�B���%�%�#�0�*0�*�*�_�*E�*E�0;�0C����{�I[�I[�')�z�t�t�u�R�y�y�')�z�t�t�u�R�y�y�')�z�t�t�u�R�y�y�')�z�t�t�u�R�y�y�
���	�	� ���K��r?�core_schema.StringSchemac�P�ddi}|�|||jj��|S)z�Generates a JSON schema that matches a string value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r��string�rrr)rs   r=r$zGenerateJsonSchema.str_schema�s2���x�(���$�$�[�&�$�:Q�:X�Y�Y�Y��r?�core_schema.BytesSchemac�v�d|jjdkrdndd�}|�|||jj��|S)z�Generates a JSON schema that matches a bytes value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)�base64�	base64url�binary�r��format)r�ser_json_bytesrr�bytesrs   r=�bytes_schemazGenerateJsonSchema.bytes_schema�sJ�� (�$�,�B]�ai�Bi�Bi�;�;�ow�x�x���$�$�[�&�$�:Q�:W�X�X�X��r?�core_schema.DateSchemac�R�ddd�}|�|||jj��|S)z�Generates a JSON schema that matches a date value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)�dater0)rrr7rs   r=�date_schemazGenerateJsonSchema.date_schema�s5�� (�6�:�:���$�$�[�&�$�:Q�:V�W�W�W��r?�core_schema.TimeSchemac��ddd�S)z�Generates a JSON schema that matches a time value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)�timer0rHr�s  r=�time_schemazGenerateJsonSchema.time_schema����!�F�3�3�3r?�core_schema.DatetimeSchemac��ddd�S)z�Generates a JSON schema that matches a datetime value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)z	date-timer0rHr�s  r=�datetime_schemaz"GenerateJsonSchema.datetime_schema�s��!�K�8�8�8r?�core_schema.TimedeltaSchemac�4�|jjdkrddiSddd�S)z�Generates a JSON schema that matches a timedelta value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r%r�rr)�durationr0)r�ser_json_timedeltar�s  r=�timedelta_schemaz#GenerateJsonSchema.timedelta_schema�s-���<�*�g�5�5��H�%�%� �J�7�7�7r?�core_schema.LiteralSchemac�B�d�|dD��}d�|D��}t|��dkr
d|diSd�|D��}|thkr|dd	�S|thkr|d
d	�S|thkr|dd	�S|thkr|dd	�S|t
hkr|d
d	�Sd|iS)z�Generates a JSON schema that matches a literal value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        c�J�g|] }t|t��r|jn|��!SrH)r�rr��r]rs  r=r�z5GenerateJsonSchema.literal_schema.<locals>.<listcomp>�s-��V�V�V�a�z�!�T�2�2�9�A�G�G��V�V�Vr?�expectedc�,�g|]}t|����SrH)rrIs  r=r�z5GenerateJsonSchema.literal_schema.<locals>.<listcomp>�s!��<�<�<�a�&�q�)�)�<�<�<r?r�constrc�,�h|]}t|����SrH)r�)r]r�s  r=�	<setcomp>z4GenerateJsonSchema.literal_schema.<locals>.<setcomp>�s��+�+�+�Q��a���+�+�+r?r))�enumr�rrr�arrayrO)r\r�r�r%r�rb)ryr6rJ�typess    r=�literal_schemaz!GenerateJsonSchema.literal_schema�s���W�V�6�*�CU�V�V�V��<�<�8�<�<�<���x�=�=�A����X�a�[�)�)�+�+�(�+�+�+���S�E�>�>�$�h�7�7�7�
�s�e�^�^�$�i�8�8�8�
�u�g�
�
�$�h�7�7�7�
�t�f�_�_�$�i�8�8�8�
�t�f�_�_�$�g�6�6�6��H�%�%r?�core_schema.IsInstanceSchemac�B�|�|d|d�d���S)z�Generates a JSON schema that checks if a value is an instance of a class, equivalent to Python's
        `isinstance` method.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        zcore_schema.IsInstanceSchema (�clsr���handle_invalid_for_json_schemar�s  r=�is_instance_schemaz%GenerateJsonSchema.is_instance_schema�s-���2�2�6�;l�\b�ch�\i�;l�;l�;l�m�m�mr?�core_schema.IsSubclassSchemac��iS)z�Generates a JSON schema that checks if a value is a subclass of a class, equivalent to Python's `issubclass`
        method.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rHr�s  r=�is_subclass_schemaz%GenerateJsonSchema.is_subclass_schemas	���	r?�core_schema.CallableSchemac�.�|�|d��S)z�Generates a JSON schema that matches a callable value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r\rVr�s  r=�callable_schemaz"GenerateJsonSchema.callable_schema
s���2�2�6�;W�X�X�Xr?�core_schema.ListSchemac��d|vrin|�|d��}d|d�}|�|||jj��|S)z�Returns a schema that matches a list schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �items_schemarP�r�rd�r�rrrP�ryr6rar�s    r=�list_schemazGenerateJsonSchema.list_schema�]��,�6�9�9�r�r�t�?R�?R�SY�Zh�Si�?j�?j��&��>�>���$�$�[�&�$�:Q�:W�X�X�X��r?�!core_schema.TuplePositionalSchemac�.��ddi}t|d��|d<�fd�|dD��}|r||d<d|vr��|d��|d<nt|d��|d	<��||�jj��|S)
z�Generates a JSON schema that matches a positional tuple schema e.g. `Tuple[int, str, bool]`.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�rPra�minItemsc�:��g|]}��|����SrH�r�r�s  �r=r�z>GenerateJsonSchema.tuple_positional_schema.<locals>.<listcomp>1s'���T�T�T�T�t�*�*�4�0�0�T�T�Tr?�prefixItems�
extras_schemard�maxItems)r\r�rrrP)ryr6r�rls`   r=�tuple_positional_schemaz*GenerateJsonSchema.tuple_positional_schema&s����)/��'8��"%�f�^�&<�"=�"=��J��T�T�T�T�V�N�=S�T�T�T���	5�)4�K�
�&��f�$�$�#'�#6�#6�v�o�7N�#O�#O�K�� � �&)�&��*@�&A�&A�K�
�#��$�$�[�&�$�:Q�:W�X�X�X��r?�core_schema.TupleVariableSchemac��d|vrin|�|d��}d|d�}|�|||jj��|S)z�Generates a JSON schema that matches a variable tuple schema e.g. `Tuple[int, ...]`.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rarPrbrcrds    r=�tuple_variable_schemaz(GenerateJsonSchema.tuple_variable_schema;rfr?�core_schema.SetSchemac�,�|�|��S)z�Generates a JSON schema that matches a set schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        ��_common_set_schemar�s  r=�
set_schemazGenerateJsonSchema.set_schemaI����&�&�v�.�.�.r?�core_schema.FrozenSetSchemac�,�|�|��S)z�Generates a JSON schema that matches a frozenset schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rur�s  r=�frozenset_schemaz#GenerateJsonSchema.frozenset_schemaTrxr?�3core_schema.SetSchema | core_schema.FrozenSetSchemac��d|vrin|�|d��}dd|d�}|�|||jj��|S)NrarPT)r��uniqueItemsrdrcrds    r=rvz%GenerateJsonSchema._common_set_schema_s]��+�6�9�9�r�r�t�?R�?R�SY�Zh�Si�?j�?j��&�t�l�S�S���$�$�[�&�$�:Q�:W�X�X�X��r?�core_schema.GeneratorSchemac��d|vrin|�|d��}d|d�}|�|||jj��|S)z�Returns a JSON schema that represents the provided GeneratorSchema.

        Args:
            schema: The schema.

        Returns:
            The generated JSON schema.
        rarPrbrcrds    r=�generator_schemaz#GenerateJsonSchema.generator_schemaerfr?�core_schema.DictSchemac��ddi}d|vr-|�|d�����ni}|�dd��}d|vr-|�|d�����ni}|�dd��|s|�|�||d<n||i|d	<|�|||jj��|S)
z�Generates a JSON schema that matches a dict schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r��object�keys_schema�patternN�
values_schema�title�additionalProperties�patternProperties)r�r�r�rrr�)ryr6r�r��keys_patternr�s      r=�dict_schemazGenerateJsonSchema.dict_schemass���)/��'9��KX�\b�Kb�Kb�d�)�)�&��*?�@�@�E�E�G�G�G�hj��"���y�$�7�7��O^�bh�Oh�Oh��+�+�F�?�,C�D�D�I�I�K�K�K�np�
����'�4�(�(�(��	Q�L�4��#�6C��2�3�3�4@�-�3P��/�0��$�$�[�&�$�:Q�:X�Y�Y�Y��r?�_core_utils.AnyFunctionSchemac��tj|��r|�|d��S|�|d|d�d���S)Nr6z*core_schema.PlainValidatorFunctionSchema (�functionr�)r!�is_function_with_inner_schemar�rWr�s  r=�_function_schemaz#GenerateJsonSchema._function_schema�sb���4�V�<�<�	9��&�&�v�h�'7�8�8�8��2�2��V��
�AS�V�V�V�
�
�	
r?�)core_schema.BeforeValidatorFunctionSchemac�,�|�|��S)z�Generates a JSON schema that matches a function-before schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �r�r�s  r=�function_before_schemaz)GenerateJsonSchema.function_before_schema�����$�$�V�,�,�,r?�(core_schema.AfterValidatorFunctionSchemac�,�|�|��S)z�Generates a JSON schema that matches a function-after schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�r�s  r=�function_after_schemaz(GenerateJsonSchema.function_after_schema�r�r?�(core_schema.PlainValidatorFunctionSchemac�,�|�|��S)z�Generates a JSON schema that matches a function-plain schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�r�s  r=�function_plain_schemaz(GenerateJsonSchema.function_plain_schema�r�r?�'core_schema.WrapValidatorFunctionSchemac�,�|�|��S)z�Generates a JSON schema that matches a function-wrap schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�r�s  r=�function_wrap_schemaz'GenerateJsonSchema.function_wrap_schema�r�r?�core_schema.WithDefaultSchemac��|�|d��}d|vr|S|d}	|�|��}n1#tj$r|�dd|�d���|cYSwxYwd|vr|g|d�S||d<|S)z�Generates a JSON schema that matches a schema with a default value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r6�defaultrAzDefault value z= is not JSON serializable; excluding default from JSON schemar�)r�r�)r��encode_default�
pydantic_core�PydanticSerializationError�emit_warning)ryr6r�r��encoded_defaults     r=�default_schemaz!GenerateJsonSchema.default_schema�s����)�)�&��*:�;�;���F�"�"�����#��	�"�1�1�'�:�:�O�O���7�	�	�	����*�g��g�g�g�
�
�
�
����
	�����[� � �)�]��G�G�G�%4�K�	�"��s�A�+A/�.A/�core_schema.NullableSchemac�~�ddi}|�|d��}||kr|S|�||g��S)z�Generates a JSON schema that matches a schema that allows null values.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�r�r6)r��get_flattened_anyof)ryr6�null_schema�inner_json_schemas    r=�nullable_schemaz"GenerateJsonSchema.nullable_schema�sT���v�&�� �/�/��x�0@�A�A����+�+����+�+�->��,L�M�M�Mr?�core_schema.UnionSchemac��g}|d}|D]�}t|t��r|dn|}	|�|�|�����K#t$rY�Wt
$r%}|�d|j��Yd}~��d}~wwxYwt|��dkr|dS|�	|��S)z�Generates a JSON schema that matches a schema that allows values matching any of the given schemas.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �choicesrr@Nr)
r��tuplercr�rr)r��messager\r�)ryr6�	generatedr��choice�
choice_schema�excs       r=�union_schemazGenerateJsonSchema.union_schemas���,.�	���#���	A�	A�F�)3�F�E�)B�)B�N�F�1�I�I��M�
A�� � ��!4�!4�]�!C�!C�D�D�D�D���
�
�
���/�
A�
A�
A��!�!�"2�C�K�@�@�@�@�@�@�@�@�����
A�����y�>�>�Q����Q�<���'�'�	�2�2�2s�(A�
B�$	B�-B
�
B�core_schema.TaggedUnionSchemac�.�i}|d���D]�\}}t|t��r|j}	|�|�����|t
|��<�Z#t$rY�ft$r%}|�	d|j
��Yd}~��d}~wwxYwt|�����}d|i}|�
||��}|�$|d�|���D��d�|d<|S)acGenerates a JSON schema that matches a schema that allows values matching any of the given schemas, where
        the schemas are tagged with a discriminator field that indicates which schema should be used to validate
        the value.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�r@N�oneOfc�B�i|]\}}||�d|����S)r��rwrs   r=r�z:GenerateJsonSchema.tagged_union_schema.<locals>.<dictcomp>:s,��N�N�N�D�A�q�A�q�u�u�V�Q�/�/�N�N�Nr?)�propertyNamer��
discriminator)rdr�rr�r�r�r�rr)r�r�re�values�_extract_discriminator)	ryr6r�r
rr��one_of_choicesr��openapi_discriminators	         r=�tagged_union_schemaz&GenerateJsonSchema.tagged_union_schemasY��13�	��9�%�+�+�-�-�
	A�
	A�D�A�q��!�T�"�"�
��G��
A�%)�$7�$7��$:�$:�$?�$?�$A�$A�	�#�a�&�&�!�!���
�
�
���/�
A�
A�
A��!�!�"2�C�K�@�@�@�@�@�@�@�@�����
A����.�i�.>�.>�.@�.@�A�A��(/��'@��!%� ;� ;�F�N� S� S�� �,� 5�N�N�I�O�O�<M�<M�N�N�N�,�,�K��(�
�s�7A7�7
B1�	B1�B,�,B1r��list[_JsonDict]�
str | Nonec���d}t|dt��r|dSt|dt���r+t|d��dkr/t|ddt��r|ddS|dD]�}t|t��sn�t|��dkr�-|d}t|t��s�Kd}|D]�}d|vrKt|dt��sJ�|�t|d����pi}d|v�K|�di��}t|t��r||vrd}n��|r|}n��|S)	zvExtract a compatible OpenAPI discriminator from the schema and one_of choices that end up in the final
        schema.Nr�rrTr��
propertiesF)r�r�rbr\r�rKrwr�)	ryr6r�r��
alias_path�alias�alias_is_present_on_all_choicesr�r�s	         r=r�z)GenerateJsonSchema._extract_discriminator?s���
-1���f�_�-�s�3�3�	+��/�*�*��f�_�-�t�4�4�	��6�/�*�+�+�q�0�0�Z���@W�XY�@Z�\_�5`�5`�0��o�.�q�1�1�
%�_�5�
�
�
�!�*�d�3�3���E��z�?�?�a�'�'��"�1�
��!�%��-�-���26�/�,���F� �F�*�*�)�&��.�#�>�>�>�>�>�!%�!A�!A�'�&�QW�.�BY�BY�!Z�!Z�!`�^`��!�F�*�*�"(���L�"�!=�!=�J�%�j�$�7�7��5�
�;R�;R�:?�7���<S�3��,1�)��E��%�$r?�core_schema.ChainSchemac�b�|jdkrdnd}|�|d|��S)a�Generates a JSON schema that matches a core_schema.ChainSchema.

        When generating a schema for validation, we return the validation JSON schema for the first step in the chain.
        For serialization, we return the serialization JSON schema for the last step in the chain.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r1r����steps)r�r�)ryr6�
step_indexs   r=�chain_schemazGenerateJsonSchema.chain_schemags6���)�|�3�3�Q�Q��
��"�"�6�'�?�:�#>�?�?�?r?�core_schema.LaxOrStrictSchemac��|�dd��}|r|�|d��S|�|d��S)z�Generates a JSON schema that matches a schema that allows values matching either the lax schema or the
        strict schema.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �strictF�
strict_schema�
lax_schema)rwr�)ryr6�
use_stricts   r=�lax_or_strict_schemaz'GenerateJsonSchema.lax_or_strict_schemavsS���Z�Z��%�0�0�
��	=��&�&�v�o�'>�?�?�?��&�&�v�l�';�<�<�<r?�core_schema.JsonOrPythonSchemac�8�|�|d��S)a�Generates a JSON schema that matches a schema that allows values matching either the JSON schema or the
        Python schema.

        The JSON schema is used instead of the Python schema. If you want to use the Python schema, you should override
        this method.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�rkr�s  r=�json_or_python_schemaz(GenerateJsonSchema.json_or_python_schema�s���"�"�6�-�#8�9�9�9r?�core_schema.TypedDictSchemac����|�dd�����fd�|d���D��}�jdkr<|���|�dg������t|��}�j�|��5��|��}ddd��n#1swxYwY|�dd	��}|d
krd|d<n|d
krd|d<|S)z�Generates a JSON schema that matches a schema that defines a typed dict.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �totalTc�r��g|]3\}}��|���|��|���|f��4SrH��field_is_present�field_is_required)r]�name�fieldryr�s   ��r=r�z8GenerateJsonSchema.typed_dict_schema.<locals>.<listcomp>�s_���J
�J
�J
���e��$�$�U�+�+�J
�
�4�)�)�%��7�7��?�J
�J
�J
r?�fieldsr2�computed_fieldsN�extra�ignore�forbidFr��allow)	rwrdr��extend�_name_required_computed_fields�_get_typed_dict_configr��push�_named_required_fields_schema)ryr6�named_required_fields�configr�r�r�s`     @r=�typed_dict_schemaz$GenerateJsonSchema.typed_dict_schema�s������
�
�7�D�)�)��J
�J
�J
�J
�J
�%�h�/�5�5�7�7�J
�J
�J
��
�9��'�'�!�(�(��)L�)L�V�Z�Z�Xi�km�Mn�Mn�)o�)o�p�p�p�'��/�/��
�
'�
,�
,�V�
4�
4�	T�	T��<�<�=R�S�S�K�	T�	T�	T�	T�	T�	T�	T�	T�	T�	T�	T����	T�	T�	T�	T��
�
�7�H�-�-���H���27�K�.�/�/�
�g�
�
�26�K�.�/��s�0C�C�Cr��list[ComputedField]�1list[tuple[str, bool, core_schema.ComputedField]]c��d�|D��S)Nc�$�g|]
}|dd|f��S)�
property_nameTrH)r]r�s  r=r�zEGenerateJsonSchema._name_required_computed_fields.<locals>.<listcomp>�s$��S�S�S�%���'��u�5�S�S�Sr?rH)r�s r=r�z1GenerateJsonSchema._name_required_computed_fields�s��T�S�?�S�S�S�Sr?r��+Sequence[tuple[str, bool, CoreSchemaField]]c��i}g}|D]�\}}}|jr|�||��}	|�|�����}n#t$rY�XwxYwd|vr/|�|��r|�|��}||d<|�|��}|||<|r|�|����d|d�}	|r||	d<|	S)Nr�r��r�r��required)	r��_get_alias_namer�r�r�field_title_should_be_set�get_title_from_name�handle_ref_overridesrc)
ryr�r��required_fieldsr�r�r��field_json_schemar�r�s
          r=r�z0GenerateJsonSchema._named_required_fields_schema�s*��24�
�%'��%:�
	-�
	-�!�D�(�E��}�
9��+�+�E�4�8�8��
�$(�$7�$7��$>�$>�$C�$C�$E�$E�!�!���
�
�
���
�����/�/�/�D�4R�4R�SX�4Y�4Y�/��0�0��6�6��-2�!�'�*� $� 9� 9�:K� L� L��0�J�t���
-��&�&�t�,�,�,��'�z�B�B���	6�&5�K�
�#��s�'A�
A �A r�r,r�c��|ddkr|�d|��}n8|jdkr|�d|��}n|�d|��}t|t��r|}n�t|t��rctd|��}|D]O}t|t��r8t
|��dkr%t|d	t��r
|d	}n�Pnt|��|S)
Nr��computed-fieldr�r1�validation_alias�serialization_aliaszlist[str] | strrr)rwr�r�r�rbrr\r)ryr�r�r��paths     r=r�z"GenerateJsonSchema._get_alias_name�s����=�,�,�,����7�D�1�1�E�E�
�Y�,�
&�
&��I�I�0�$�7�7�E�E��I�I�3�T�:�:�E��e�S�!�!�	 ��D�D�
��t�
$�
$�		 ��*�E�2�2�E��
�
���d�D�)�)��c�$�i�i�1�n�n��D�QR�G�UX�AY�AY�n� ��7�D��E���������r?�core_schema.TypedDictFieldc�8�|�|d��S)z�Generates a JSON schema that matches a schema that defines a typed dict field.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r6rkr�s  r=�typed_dict_field_schemaz*GenerateJsonSchema.typed_dict_field_schema�����"�"�6�(�#3�4�4�4r?�core_schema.DataclassFieldc�8�|�|d��S)z�Generates a JSON schema that matches a schema that defines a dataclass field.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r6rkr�s  r=�dataclass_field_schemaz)GenerateJsonSchema.dataclass_field_schema�r
r?�core_schema.ModelFieldc�8�|�|d��S)z�Generates a JSON schema that matches a schema that defines a model field.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r6rkr�s  r=�model_field_schemaz%GenerateJsonSchema.model_field_schemar
r?�core_schema.ComputedFieldc�8�|�|d��S)z�Generates a JSON schema that matches a schema that defines a computed field.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �
return_schemarkr�s  r=�computed_field_schemaz(GenerateJsonSchema.computed_field_schemas���"�"�6�/�#:�;�;�;r?�core_schema.ModelSchemac���td|d��}|j}|�d��}|j�|��5|�|d��}ddd��n#1swxYwY|�d��}|jr)|jdj}|r|rtd���|r|}|�
|||�d	d��||��}|S)
z�Generates a JSON schema that matches a schema that defines a model.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        ztype[BaseModel]rUr�r6N�json_schema_extra�rootzz"model_config['json_schema_extra']" and "Field.json_schema_extra" on "RootModel.root" field must not be set simultaneouslyr�)r�model_configrwr�r�r��__pydantic_root_model__�model_fieldsr�
ValueError�_update_class_schema)ryr6rUr�r�r�r�root_json_schema_extras        r=�model_schemazGenerateJsonSchema.model_schemas`���$�f�U�m�4�4���!���
�
�7�#�#��
�
'�
,�
,�V�
4�
4�	@�	@��-�-�f�X�.>�?�?�K�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@����	@�	@�	@�	@�#�J�J�':�;�;���&�	;�%(�%5�f�%=�%O�"� �
�%;�
� �<����&�
;�$:�!��/�/��U�F�J�J�w�X\�D]�D]�_b�du�v�v���s�
A5�5A9�<A9r�r�r��+Literal['allow', 'ignore', 'forbid'] | NonerU�	type[Any]r�/dict[str, Any] | JsonSchemaExtraCallable | Nonec�T�d|vr+|�t|d����p|}n|}|�|�d|��d|vr|dkrd|d<n|dkrd|d<t|tt
f��r|�|��}t|t��r|�|��ngt|��rCttj|��j
��dkr
|||��n!||��n|�td	|�d
����|S)Nr�r�r�r�Tr�Frz"model_config['json_schema_extra']=z$ should be a dict, callable, or None)r�rK�
setdefaultr�r��classmethod�__get__r�r<�callabler\�inspect�	signature�
parametersr)ryr�r�r�rUr�schema_to_updates       r=rz'GenerateJsonSchema._update_class_schema7s~���[� � �#�?�?���TZ�H[�@\�@\�]�]�l�al���*�����'�'���7�7�7�!�)9�9�9�����;?� �!7�8�8��(�"�"�;@� �!7�8��'�,��)D�E�E�	?� 1� 9� 9�#� >� >���'��.�.�
	��#�#�$5�6�6�6�6�
�'�
(�
(�	��7�$�%6�7�7�B�C�C�a�G�G�!�!�"2�C�8�8�8�8�!�!�"2�3�3�3�3�
�
*��l�5F�l�l�l���
��r?c��d|vrW|�t|d����}|�td|d�����|�|��S|}|S)z�Resolve a JsonSchemaValue to the non-ref schema if it is a $ref schema.

        Args:
            json_schema: The schema to resolve.

        Returns:
            The resolved schema.
        r�Nz(Cannot update undefined schema for $ref=)r�rK�RuntimeError�resolve_schema_to_update)ryr�r+s   r=r.z+GenerateJsonSchema.resolve_schema_to_update`su���[� � �#�?�?���TZ�H[�@\�@\�]�]���'�"�#c�k�Z`�Na�#c�#c�d�d�d��0�0�1A�B�B�B�*���r?�core_schema.ModelFieldsSchemac����fd�|d���D��}�jdkr<|���|�dg��������|��}|�dd��}|�-��|��}��|��|d<|S)z�Generates a JSON schema that matches a schema that defines a model's fields.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        c�t��g|]4\}}��|���|��|d���|f��5S)T�r�r�)r]r�r�rys   �r=r�z:GenerateJsonSchema.model_fields_schema.<locals>.<listcomp>{sb���J
�J
�J
���e��$�$�U�+�+�J
�
�4�)�)�%�t�)�<�<�e�D�J
�J
�J
r?r�r2r�rmNr�)rdr�r�r�rwr�r.r�)ryr6r�r�rmr+s`     r=�model_fields_schemaz&GenerateJsonSchema.model_fields_schemars����J
�J
�J
�J
�%�h�/�5�5�7�7�J
�J
�J
��
�9��'�'�!�(�(��)L�)L�V�Z�Z�Xi�km�Mn�Mn�)o�)o�p�p�p��8�8�9N�O�O���
�
�?�D�9�9�
��$�#�<�<�[�I�I��7;�7J�7J�=�7Y�7Y��3�4��r?c��|jdkr|�d��S|jdkrdSt|j��dS)aWhether the field should be included in the generated JSON schema.

        Args:
            field: The schema for the field itself.

        Returns:
            `True` if the field should be included in the generated JSON schema, `False` otherwise.
        r2�serialization_excluder1TN)r�rwr)ryr�s  r=r�z#GenerateJsonSchema.field_is_present�sQ���9��'�'��y�y�!8�9�9�9�9�
�Y�,�
&�
&��4����#�#�#�#�#r?�Pcore_schema.ModelField | core_schema.DataclassField | core_schema.TypedDictFieldr�c���|jdkr"|jjr|�d��S|ddkr|�d|��S|dddkS)aYWhether the field should be marked as required in the generated JSON schema.
        (Note that this is irrelevant if the field is not present in the JSON schema.).

        Args:
            field: The schema for the field itself.
            total: Only applies to `TypedDictField`s.
                Indicates if the `TypedDict` this field belongs to is total, in which case any fields that don't
                explicitly specify `required=False` are required.

        Returns:
            `True` if the field should be marked as required in the generated JSON schema, `False` otherwise.
        r2r5r�ztyped-dict-fieldr�r6r�)r�r�+json_schema_serialization_defaults_requiredrw)ryr�r�s   r=r�z$GenerateJsonSchema.field_is_required�si��"�9��'�'�D�L�,d�'��y�y�!8�9�9�9�9��V�}� 2�2�2��y�y��U�3�3�3��X��v�.�)�;�;r?�core_schema.DataclassArgsSchemac�����fd�|dD��}�jdkr<|���|�dg��������|��S)z�Generates a JSON schema that matches a schema that defines a dataclass's constructor arguments.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        c�z��g|]7}��|���|d��|d���|f��8S)r�Tr2r�)r]r�rys  �r=r�z<GenerateJsonSchema.dataclass_args_schema.<locals>.<listcomp>�sb���J
�J
�J
���$�$�U�+�+�J
�
�6�]�D�2�2�5��2�E�E�u�M�J
�J
�J
r?r�r2r�)r�r�r�rwr�)ryr6r�s`  r=�dataclass_args_schemaz(GenerateJsonSchema.dataclass_args_schema�s����J
�J
�J
�J
���)�J
�J
�J
��
�9��'�'�!�(�(��)L�)L�V�Z�Z�Xi�km�Mn�Mn�)o�)o�p�p�p��1�1�2G�H�H�Hr?�core_schema.DataclassSchemac�d�|d}t|dtdi����}|�d��p|j}|j�|��5|�|d�����}ddd��n#1swxYwY|�d��}|�|||�dd��||��}t|��rt|d	��sd}n"|j�dntj
|j��}|r||d
<|S)z�Generates a JSON schema that matches a schema that defines a dataclass.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rU�__pydantic_config__r+r�r6Nrr��__pydantic_validator__�description)r�rrwrDr�r�r�r�rr�hasattrrGr(�cleandoc)ryr6rUr�r�r�rrAs        r=�dataclass_schemaz#GenerateJsonSchema.dataclass_schema�s����U�m��$�S�*?��l�TV�AW�AW�X�X���
�
�7�#�#�3�s�|��
�
'�
,�
,�V�
4�
4�	G�	G��-�-�f�X�.>�?�?�D�D�F�F�K�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G����	G�	G�	G�	G�#�J�J�':�;�;���/�/��U�F�J�J�w�X\�D]�D]�_b�du�v�v������	Y�W�S�2J�%K�%K�	Y��K�K�"%�+�"5�$�$�7�;K�C�K�;X�;X�K��	5�)4�K�
�&��s�.B�B�B�core_schema.ArgumentsSchemac��tj|��j}|�d��}|d}d�|D��}d�|D��}d�|D��}|�d��}|�d��}	|r!|o|	}
|
r|�||z|��S|o|}|r|�||z|	��S|s!|o|	}
|
r|�||z|��St
d���)	z�Generates a JSON schema that matches a schema that defines a function's arguments.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �'pydantic_js_prefer_positional_arguments�arguments_schemac�D�g|]}|�d��dk�|��S)r��keyword_onlyr��r]�as  r=r�z7GenerateJsonSchema.arguments_schema.<locals>.<listcomp>�s,��U�U�U�1�Q�U�U�6�]�]�n�5T�5T�Q�5T�5T�5Tr?c�@�g|]}|�d��dv�|��S)r�>N�positional_or_keywordr�rKs  r=r�z7GenerateJsonSchema.arguments_schema.<locals>.<listcomp>�s-��f�f�f�1�Q�U�U�6�]�]�Fe�5e�5e�Q�5e�5e�5er?c�D�g|]}|�d��dk�|��S)r��positional_onlyr�rKs  r=r�z7GenerateJsonSchema.arguments_schema.<locals>.<listcomp>�s-��W�W�W�!�A�E�E�&�M�M�EV�4V�4V�A�4V�4V�4Vr?�var_args_schema�var_kwargs_schemazfUnable to generate JSON schema for arguments validator with positional-only and keyword-only arguments)r r�r�rw�p_arguments_schema�kw_arguments_schemar))ryr6r��prefer_positional�	arguments�kw_only_arguments�kw_or_p_arguments�p_only_argumentsrQrR�positional_possible�keyword_possibles            r=rHz#GenerateJsonSchema.arguments_schema�si��"�5�f�=�=�F��$�L�L�)R�S�S���-�.�	�U�U�	�U�U�U��f�f�	�f�f�f��W�W�y�W�W�W�� �*�*�%6�7�7��"�J�J�':�;�;���	f�&7�"7�"Q�@Q�<Q��"�
f��.�.�/?�BS�/S�Ud�e�e�e�/�/�G��4G���	f��+�+�,=�@Q�,Q�Sd�e�e�e� �	f�&7�"7�"Q�@Q�<Q��"�
f��.�.�/?�BS�/S�Ud�e�e�e�+�t�
�
�	
r?rV�$list[core_schema.ArgumentsParameter]rR�CoreSchema | Nonec��i}g}|D]�}|�|��}|�|d�����}|�|��|d<|||<|dddkr|�|����d|d�}|r||d<|r|�|��}	|	r|	|d<nd	|d<|S)
z�Generates a JSON schema that matches a schema that defines a function's keyword arguments.

        Args:
            arguments: The core schema.

        Returns:
            The generated JSON schema.
        r6r�r�r�r�r�r�r�F)�get_argument_namer�r�r�rc)
ryrVrRr�r��argumentr��argument_schemar��additional_properties_schemas
          r=rTz&GenerateJsonSchema.kw_arguments_schemas��24�
� ��!�
	&�
	&�H��)�)�(�3�3�D�"�1�1�(�8�2D�E�E�J�J�L�L�O�'+�'?�'?��'E�'E�O�G�$�.�J�t����!�&�)�Y�6�6�����%�%�%��08�
�'S�'S���	/�&.�K�
�#��	8�+/�+>�+>�?P�+Q�+Q�(�+�
S�6R��2�3��27�K�.�/��r?rQc��g}d}|D]�}|�|��}|�|d�����}|�|��|d<|�|��|dddkr|dz
}��d|d�}|r||d	<|r|�|��}	|	r|	|d
<nt|��|d<|S)z�Generates a JSON schema that matches a schema that defines a function's positional arguments.

        Args:
            arguments: The core schema.

        Returns:
            The generated JSON schema.
        rr6r�r�r�rrP)r�rlrirdrn)r_r�r�r�rcr\)
ryrVrQ�prefix_items�	min_itemsr`r�rar�ras
          r=rSz%GenerateJsonSchema.p_arguments_schema0s��/1���	�!�	�	�H��)�)�(�3�3�D�"�1�1�(�8�2D�E�E�J�J�L�L�O�'+�'?�'?��'E�'E�O�G�$�����0�0�0���!�&�)�Y�6�6��Q��	��07��'U�'U���	0�&/�K�
�#��	8��.�.��?�?�L��
4�'3��G�$��&)�,�&7�&7�K�
�#��r?r`�core_schema.ArgumentsParameterc��|d}|jr.|�d��}t|t��r|}n	|S)z�Retrieves the name of an argument.

        Args:
            argument: The core schema.

        Returns:
            The name of the argument.
        r�r�)r�rwr�r�)ryr`r�r�s    r=r_z$GenerateJsonSchema.get_argument_nameXsJ�������=�	��L�L��)�)�E��%��%�%�
������r?�core_schema.CallSchemac�8�|�|d��S)z�Generates a JSON schema that matches a schema that defines a function call.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rHrkr�s  r=�call_schemazGenerateJsonSchema.call_schemajs���"�"�6�*<�#=�>�>�>r?�core_schema.CustomErrorSchemac�8�|�|d��S)z�Generates a JSON schema that matches a schema that defines a custom error.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r6rkr�s  r=�custom_error_schemaz&GenerateJsonSchema.custom_error_schemaur
r?�core_schema.JsonSchemac��|�d��ptj��}|�|��}|jdkrdd|d�S|S)z�Generates a JSON schema that matches a schema that defines a JSON object.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r6r1r)zapplication/json)r��contentMediaType�
contentSchema)rwrr�r�r�)ryr6�content_core_schema�content_json_schemas    r=r�zGenerateJsonSchema.json_schema�s`��%�j�j��2�2�N�k�6L�6N�6N��"�1�1�2E�F�F���9��$�$�$�:L�_r�s�s�s�'�&r?�core_schema.UrlSchemac�T�dddd�}|�|||jj��|S)z�Generates a JSON schema that matches a schema that defines a URL.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)�urir�r�r1�	minLengthr*rs   r=�
url_schemazGenerateJsonSchema.url_schema�s7�� (�5�q�I�I���$�$�[�&�$�:Q�:X�Y�Y�Y��r?�core_schema.MultiHostUrlSchemac�T�dddd�}|�|||jj��|S)z�Generates a JSON schema that matches a schema that defines a URL that can be used with multiple hosts.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)zmulti-host-urirrwr*rs   r=�multi_host_url_schemaz(GenerateJsonSchema.multi_host_url_schema�s9�� (�3C�RS�T�T���$�$�[�&�$�:Q�:X�Y�Y�Y��r?�core_schema.UuidSchemac��ddd�S)z�Generates a JSON schema that matches a UUID.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r)�uuidr0rHr�s  r=�uuid_schemazGenerateJsonSchema.uuid_schema�r=r?�core_schema.DefinitionsSchemac��|dD]h}	|�|���#t$rC}t|d��}||j|�||jf��<Yd}~�ad}~wwxYw|�|d��S)z�Generates a JSON schema that matches a schema that defines a JSON object with definitions.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        rVrtNr6)r�r)rIr��get_defs_refr�)ryr6�
definitionr�r�s     r=riz%GenerateJsonSchema.definitions_schema�s���!��/�	�	�J�
��#�#�J�/�/�/�/��/�
�
�
�$+�J�u�,=�$>�$>��de��7��8I�8I�8�UY�U^�J_�8`�8`�a����������
�����"�"�6�(�#3�4�4�4s�"�
A/�9A*�*A/�%core_schema.DefinitionReferenceSchemac�`�t|d��}|�|��\}}|S)z�Generates a JSON schema that matches a schema that references a definition.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        �
schema_ref)rIr�)ryr6r�r�r�s     r=�definition_ref_schemaz(GenerateJsonSchema.definition_ref_schema�s4���6�,�/�0�0��!�;�;�H�E�E���?��r?�Vcore_schema.SerSchema | core_schema.IncExSeqSerSchema | core_schema.IncExDictSerSchema�JsonSchemaValue | Nonec�:�|d}|dks|dkr-|�d��}|�|�|��SnY|dks|dkr&|�tj����S|ddkr|�|d	��SdS)
z�Generates a JSON schema that matches a schema that defines a serialized object.

        Args:
            schema: The core schema.

        Returns:
            The generated JSON schema.
        r�zfunction-plainz
function-wraprNr1z	to-string�modelr6)rwr�r$r)ryr6�schema_typers    r=r�zGenerateJsonSchema.ser_schema�s����V�n���*�*�*�k�_�.L�.L�"�J�J��7�7�M��(��*�*�=�9�9�9�)�
�H�
$�
$��{�(B�(B��?�?�;�#9�#;�#;�<�<�<�
�F�^�w�
&�
&��&�&�v�h�'7�8�8�8��tr?c�R�|����dd��S)z�Retrieves a title from a name.

        Args:
            name: The name to retrieve a title from.

        Returns:
            The title.
        r�� )r�r��ryr�s  r=r�z&GenerateJsonSchema.get_title_from_name�s"���z�z�|�|�#�#�C��-�-�-r?c���tj|��r2|ddkr	|d}n|d}|�|��Stj|��r{|�d��rdS|ddvr|�|d��Stj|��r|�|d��S|ddkrdSd	St
d
|�����)a�Returns true if a field with the given schema should have a title set based on the field name.

        Intuitively, we want this to return true for schemas that wouldn't otherwise provide their own title
        (e.g., int, float, str), and false for those that would (e.g., BaseModel subclasses).

        Args:
            schema: The schema to check.

        Returns:
            `True` if the field should have a title set, `False` otherwise.
        r�rrr6rtF>r��nullablerVzdefinition-refTr�)r!r�r�r�rwr�r))ryr6�field_schemas   r=r�z,GenerateJsonSchema.field_title_should_be_set�s���+�F�3�3�	[��f�~�!1�1�1�%�o�6���%�h�/���1�1�,�?�?�?�
�
'��
/�
/�	[��z�z�%� � �
��u��f�~�!G�G�G��5�5�f�X�6F�G�G�G��8��@�@�
H��5�5�f�X�6F�G�G�G��f�~�!1�1�1��u��4�/�/Y�QW�/Y�/Y�Z�Z�Zr?c�V�tjdd|���dd��S)z�Normalizes a name to be used as a key in a dictionary.

        Args:
            name: The name to normalize.

        Returns:
            The normalized name.
        z[^a-zA-Z0-9.\-_]r�r��__)�re�subr�r�s  r=�normalize_namez!GenerateJsonSchema.normalize_names)���v�)�3��5�5�=�=�c�4�H�H�Hr?r��CoreModeRefrJc��|\}}tjd|��}d�|D��}d�|��}d�|D��}d�|��}t|}t	|�|����}t	|�|��d|��z��}	t	|�|����}
t	|
�d|����}t	|�|����}|j�|��}
|
�,|j|
xxdz
cc<|j|
x}
|j|<t	|
�d|
����}t	|�d|
����}||	|
|||g|j	|<|S)	z�Override this method to change the way that definitions keys are generated from a core reference.

        Args:
            core_mode_ref: The core reference.

        Returns:
            The definitions key.
        z([\][,])c�D�g|]}|�d��d��S)�:r)�split�r]r^s  r=r�z3GenerateJsonSchema.get_defs_ref.<locals>.<listcomp>7s&��:�:�:�!�a�g�g�c�l�l�1�o�:�:�:r?�c�:�g|]}tjdd|����S)z(?:[^.[\]]+\.)+((?:[^.[\]]+))z\1)r�r�r�s  r=r�z3GenerateJsonSchema.get_defs_ref.<locals>.<listcomp>:s'��]�]�]�Q�b�f�=�u�a�H�H�]�]�]r?r�Nrr�)
r�r��joinr5rJr�r�rwr�r�)ryr�r�r��
components�core_ref_no_id�	short_ref�
mode_titler��	name_mode�module_qualname�module_qualname_mode�module_qualname_id�occurrence_index�module_qualname_occurrence�module_qualname_occurrence_modes                r=r�zGenerateJsonSchema.get_defs_ref*s���'���$��X�k�8�4�4�
�:�:�z�:�:�:�
�����,�,��]�]�R\�]�]�]�
��G�G�J�'�'�	�(��.�
�
�t�*�*�9�5�5�6�6���D�/�/�	�:�:�=M��=M�=M�M�N�N�	�!�$�"5�"5�n�"E�"E�F�F��&�/�'H�'H�J�'H�'H�I�I��$�T�%8�%8��%B�%B�C�C���0�4�4�5G�H�H���#��#�O�4�4�4��9�4�4�4�KO�Kb�cr�Ks�s��t�4�5G�H�%,��-U�-U�CS�-U�-U�%V�%V�"�*1�5I�2_�2_�M]�2_�2_�*`�*`�'�
��� �&�+�
N
��)�*I�J�/�.r?r�rI�tuple[DefsRef, JsonSchemaValue]c�L�||jf}|j�|��}|�|j|}|d|ifS|�|��}||j|<||j|<t
|j�|�����}||j|<||j	|<d|i}||fS)a�This method wraps the get_defs_ref method with some cache-lookup/population logic,
        and returns both the produced defs_ref and the JSON schema that will refer to the right definition.

        Args:
            core_ref: The core reference to get the definitions reference for.

        Returns:
            A tuple of the definitions reference and the JSON schema that will refer to it.
        Nr��r�)
r�r�rwr�r�r�rKr�r1r�)ryr�r��maybe_defs_refr�rkr�s       r=r�z,GenerateJsonSchema.get_cache_defs_ref_schemaZs���"�4�9�-�
��/�3�3�M�B�B���%��-�m�<�H�!�F�H�#5�5�5��$�$�]�3�3��19���}�-�+8���x�(��4�,�3�3�(�3�C�C�D�D��08���}�-�+3���x�(�!�8�,����(�(r?c�J�d|v�r|���}|�t|d����}|�et|��dkrP|���}|�dg��|d�d|di��|d=|St
|�����D]\}}|dkr�||vr|||kr||=� t|��dkr&t|d��}|d=d|vsJ�d|ig|d<|S)aQIt is not valid for a schema with a top-level $ref to have sibling keys.

        During our own schema generation, we treat sibling keys as overrides to the referenced schema,
        but this is not how the official JSON schema spec works.

        Because of this, we first remove any sibling keys that are redundant with the referenced schema, then if
        any remain, we transform the schema from a top-level '$ref' to use allOf to move the $ref out of the top level.
        (See bottom of https://swagger.io/docs/specification/using-ref/ for a reference about this behavior)
        r�Nrr�)r�r�rKr\r$rcrbrd)ryr��referenced_json_schemar
rr�s      r=r�z'GenerateJsonSchema.handle_ref_overridesvsc���[� � �%�*�*�,�,�K�%)�%E�%E�g�k�Z`�Na�Fb�Fb�%c�%c�"�%�-��{�#�#�a�'�'�"-�"2�"2�"4�"4�K��*�*�7�B�7�7�7���(�/�/���V�9L�0M�N�N�N�#�F�+�"�"��[�.�.�0�0�1�1�
'�
'���1���;�;���.�.�.�3I�!�3L�PQ�3Q�3Q�#�A����;���!�#�#�"�;�v�#6�7�7����'��k�1�1�1�1�)/��(:�';��G�$��r?r�rKc�~�|j|}||jvr
|j|�|j�|d��Srv)r�r�rVrw)ryr��def_refs   r=r�z.GenerateJsonSchema.get_schema_from_definitions�sD���(��2���d�=�=�=��9�'�B�B���#�#�G�T�2�2�2r?�dftr	c�R�|j}tj||j|j���S)aEncode a default value to a JSON-serializable value.

        This is used to encode default values for fields in the generated JSON schema.

        Args:
            dft: The default value to encode.

        Returns:
            The encoded default value.
        )�timedelta_mode�
bytes_mode)rr�rrDr2)ryr�r�s   r=r�z!GenerateJsonSchema.encode_default�s4������/��!�4��,�
�
�
�	
r?rr��dict[str, str]�Nonec�X�|���D]\}}||vr||||<�dS)a�Update the json_schema with the corresponding validations specified in the core_schema,
        using the provided mapping to translate keys in core_schema to the appropriate keys for a JSON schema.

        Args:
            json_schema: The JSON schema to update.
            core_schema: The core schema to get the validations from.
            mapping: A mapping from core_schema attribute names to the corresponding JSON schema attribute names.
        N)rd)ryr�rr��core_key�json_schema_keys      r=rz*GenerateJsonSchema.update_with_validations�sI��*1�����	E�	E�%�H�o��;�&�&�/:�8�/D��O�,��	E�	Er?c�Z�eZdZdZdddddd�Zdd	d
�Zdd	dd�Zd
dd
�Zddd
�Zddddd�Z	dS)�%GenerateJsonSchema.ValidationsMappingagThis class just contains mappings from core_schema attribute names to the corresponding
        JSON schema attribute names. While I suspect it is unlikely to be necessary, you can in
        principle override this class in a subclass of GenerateJsonSchema (by inheriting from
        GenerateJsonSchema.ValidationsMapping) to change these mappings.
        �
multipleOf�maximum�minimum�exclusiveMaximum�exclusiveMinimum)rrrr r!rx�	maxLength)�
min_length�
max_lengthr�)r�r�r�rirn�
minProperties�
maxProperties)rrr r!N)
rDrErFrGrr3r)rPr�r7rHr?r=rr��s�������	�	�(���$�$�
�
��&�%�
�
��
&�%� �
�
��%�$�
�
��
*�)�
�
��
��$�$�	
�
���r?rrn�list[JsonSchemaValue]c��g}|D]J}t|��dkr d|vr|�|d���5|�|���Kt|��}t|��dkr|dSd|iS)Nrr"r)r\r�rcre)ryrn�membersr6s    r=r�z&GenerateJsonSchema.get_flattened_anyof�s������	'�	'�F��6�{�{�a���G�v�$5�$5����v�g��/�/�/�/����v�&�&�&�&�&�w�/�/���w�<�<�1����1�:����!�!r?�dict[JsonRef, int]c�N����t���d���fd���|���S)zKGet all values corresponding to the key '$ref' anywhere in the json_schema.r6r	r:r�c����t|t��r�d|vr}t|d��}t|t��sdS|�v}�|xxdz
cc<|rdS�j|}|�jvr
�j|���j|��|���D]
}�|���dSt|t��r|D]}�|���dSdS)Nr�r)	r�r�rKr�r�r�rVr�rb)r6r��already_visitedrkr�_add_json_refs�	json_refsrys     ���r=r�z>GenerateJsonSchema.get_json_ref_counts.<locals>._add_json_refs�s8����&�$�'�'�
&��V�#�#�&�v�f�~�6�6�H�%�h��4�4����&.�)�&;�O��h�'�'�'�1�,�'�'�'�&����#�5�h�?�H��4�#J�J�J�"�E�h�O�O�"�N�4�#3�H�#=�>�>�>������&�&�A�"�N�1�%�%�%�%�&�&��F�D�)�)�
&��&�&�A�"�N�1�%�%�%�%�
&�
&�&�&r?)r6r	r:r�)r)ryr�r�r�s` @@r=r�z&GenerateJsonSchema.get_json_ref_counts�sN�����(/�	�	�	�	&�	&�	&�	&�	&�	&�	&�	&�*	��{�#�#�#��r?�
error_infoc�&�td|�����)Nz!Cannot generate a JsonSchema for )r))ryr6r�s   r=rWz1GenerateJsonSchema.handle_invalid_for_json_schemas��*�+[�z�+[�+[�\�\�\r?�kind�JsonSchemaWarningKind�detailc�n�|�||��}|�tj|t��dSdS)zfThis method simply emits PydanticJsonSchemaWarnings based on handling in the `warning_message` method.N)�render_warning_message�warnings�warnrC)ryr�r�r�s    r=r�zGenerateJsonSchema.emit_warnings>���-�-�d�F�;�;�����M�'�#<�=�=�=�=�=��r?c�(�||jvrdS|�d|�d�S)amThis method is responsible for ignoring warnings as desired, and for formatting the warning messages.

        You can override the value of `ignored_warning_kinds` in a subclass of GenerateJsonSchema
        to modify what warnings are generated. If you want more control, you can override this method;
        just return None in situations where you don't want warnings to be emitted.

        Args:
            kind: The kind of warning to render. It can be one of the following:

                - 'skipped-choice': A choice field was skipped because it had no valid choices.
                - 'non-serializable-default': A default value was skipped because it was not JSON-serializable.
            detail: A string with additional details about the warning.

        Returns:
            The formatted warning message, or `None` if no warning should be emitted.
        Nz [�])r�)ryr�r�s   r=r�z)GenerateJsonSchema.render_warning_messages.��"�4�-�-�-��4��#�#�D�#�#�#�#r?rOc���i}|j���D]4}|D]/}t|j�|�����}|||<�0�5t
�|j||j��S)Nr�)r�r�rKr�r1rOrsrV)ryrT�	defs_refsrkr�s     r=r�z/GenerateJsonSchema._build_definitions_remapping2s���/1���:�A�A�C�C�	2�	2�I�%�
2�
2��"�4�#4�#;�#;�(�#;�#K�#K�L�L��)1��X�&�&�
2�%�=�=��-�|�T�=M�
�
�	
r?c�n��t���t|��}|rj|���}|j|}|�vr�(��|��|�t|j|����|�j�fd�|j���D��|_dS)Nc�$��i|]\}}|�v�	||��
SrHrH)r]r
r�visited_defs_refss   �r=r�zCGenerateJsonSchema._garbage_collect_definitions.<locals>.<dictcomp>Hs*���`�`�`�T�Q���N_�I_�I_�A�q�I_�I_�I_r?)�set�_get_all_json_refsr�r��addr<rVrd)ryr6�unvisited_json_refs�
next_json_ref�
next_defs_refr�s     @r=r�z/GenerateJsonSchema._garbage_collect_definitions=s����*-�%�%��0��8�8��!�	\�/�3�3�5�5�M� �2�=�A�M�� 1�1�1���!�!�-�0�0�0��&�&�'9�$�:J�=�:Y�'Z�'Z�[�[�[�
"�	\�a�`�`�`�T�-=�-C�-C�-E�-E�`�`�`����r?N)r�r�r�r�)r:r�)r:r�)r:r�)r�r�r:r�)r1)r6rr�r�r:r7)r6r-r:r7)r6r�r:r7)r6r�r:r7)r6rr:r7)r6rr:r7)r6rr:r7)r6rr:r7)r6r'r:r7)r6r+r:r7)r6r5r:r7)r6r9r:r7)r6r>r:r7)r6rAr:r7)r6rFr:r7)r6rSr:r7)r6rYr:r7)r6r\r:r7)r6r_r:r7)r6rgr:r7)r6rpr:r7)r6rsr:r7)r6ryr:r7)r6r|r:r7)r6rr:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r�r�r:r�)r6r�r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r7)r�r�r:r�)r�r�r:r7)r�r,r�r�r:r�)r6rr:r7)r6rr:r7)r6rr:r7)r6rr:r7)r6rr:r7)r�r7r�r�r�r rUr!rr"r:r7r�)r6r/r:r7)r�r,r:r�)r�r6r�r�r:r�)r6r9r:r7)r6r=r:r7)r6rEr:r7)rVr\rRr]r:r7)rVr\rQr]r:r7)r`rfr:r�)r6rhr:r7)r6rkr:r7)r6rnr:r7)r6rtr:r7)r6rzr:r7)r6r}r:r7)r6r�r:r7)r6r�r:r7)r6r�r:r�)r�r�r:r�)r6r-r:r�)r�r�r:rJ)r�rIr:r�)r�rKr:r�)r�r	r:r	)r�r7rrr�r�r:r�)rnr�r:r7)r�r7r:r�)r6r-r�r�r:r7)r�r�r�r�r:r�)r�r�r�r�r:r�)r:rO)r6r7r:r�)drDrErFrG�schema_dialectr�r��DEFAULT_REF_TEMPLATEr��propertyrr�r�r�r�r�r�rrrrr&r$r4r8r<r@rErRrXr[r^rerorrrwr{rvr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r
rrrrr.r3r�r�r<rDrHrTrSr_rjrmr�ryr|r�rir�r�r�r�r�r�r�r�r�r�rrr�r�rWr�r�r�r�rHr?r=r�r��s��������#�#�JD�N�:J�8J��J�J�J�J�(,�BV�"�"�"�"�"�H�/�/�/��X�/������X������4/I�/I�/I�/I�b2.�2.�2.�2.�2.�hp�p�p�p�f	�	�	�	�	 �	 �	 �	 �	#�	#�	#�	#�������������B������������	4�	4�	4�	4�	9�	9�	9�	9�8�8�8�8�&�&�&�&�@
n�
n�
n�
n�����	Y�	Y�	Y�	Y���������*����	/�	/�	/�	/�	/�	/�	/�	/�������������2
�
�
�
�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�&�&�&�&�PN�N�N�N�&3�3�3�3�2#�#�#�#�J&%�&%�&%�&%�P
@�
@�
@�
@�=�=�=�=�&
:�
:�
:�
:�����<�T�T�T��\�T�
����2����*	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	<�	<�	<�	<�����B'�'�'�'�R � � � �$����.$�$�$�$�$<�<�<�<�2I�I�I�I�$����<%
�%
�%
�%
�N#�#�#�#�J&�&�&�&�P����$	?�	?�	?�	?�	5�	5�	5�	5�'�'�'�'�"��������	4�	4�	4�	4�5�5�5�5�$��������6	.�	.�	.�	.�![�![�![�![�F	I�	I�	I�	I�./�./�./�./�`)�)�)�)�8'�'�'�'�R3�3�3�3�
�
�
�
�$
E�
E�
E�
E�$
�$
�$
�$
�$
�$
�$
�$
�L
"�
"�
"�
"�����8]�]�]�]�>�>�>�>�$�$�$�$�*	
�	
�	
�	
�a�a�a�a�a�ar?r�Tr1rU�)type[BaseModel] | type[PydanticDataclass]r�r�r�r��schema_generator�type[GenerateJsonSchema]r�r�c���|||���}t|jtj��r|j���d|jvs
Jd���|�|j|���S)a�Utility function to generate a JSON Schema for a model.

    Args:
        cls: The model class to generate a JSON Schema for.
        by_alias: If `True` (the default), fields will be serialized according to their alias.
            If `False`, fields will be serialized according to their attribute name.
        ref_template: The template to use for generating JSON Schema references.
        schema_generator: The class to use for generating the JSON Schema.
        mode: The mode to use for generating the JSON Schema. It can be one of the following:

            - 'validation': Generate a JSON Schema for validating data.
            - 'serialization': Generate a JSON Schema for serializing data.

    Returns:
        The generated JSON Schema.
    �r�r��__pydantic_core_schema__zthis is a bug! please report it)r�)r�r@r$�
MockValSer�rebuild�__dict__r�r�)rUr�r�r�r��schema_generator_instances      r=�model_json_schemar�Ns���.!1� 0�(�Q]� ^� ^� ^���#�,�m�.F�G�G�-��"�*�*�,�,�,�%���5�5�5�7X�5�5�5�$�-�-�c�.J�QU�-�V�V�Vr?)r�r�rAr�r��models�JSequence[tuple[type[BaseModel] | type[PydanticDataclass], JsonSchemaMode]]r�r�rA�otuple[dict[tuple[type[BaseModel] | type[PydanticDataclass], JsonSchemaMode], JsonSchemaValue], JsonSchemaValue]c��|D]=\}}t|jtj��r|j����>|||���}d�|D��}	|�|	��\}
}i}|r||d<|r||d<|r||d<|
|fS)a?Utility function to generate a JSON Schema for multiple models.

    Args:
        models: A sequence of tuples of the form (model, mode).
        by_alias: Whether field aliases should be used as keys in the generated JSON Schema.
        title: The title of the generated JSON Schema.
        description: The description of the generated JSON Schema.
        ref_template: The reference template to use for generating JSON Schema references.
        schema_generator: The schema generator to use for generating the JSON Schema.

    Returns:
        A tuple where:
            - The first element is a dictionary whose keys are tuples of JSON schema key type and JSON mode, and
                whose values are the JSON schema corresponding to that pair of inputs. (These schemas may have
                JsonRef references to definitions that are defined in the second returned element.)
            - The second element is a JSON schema containing all definitions referenced in the first returned
                    element, along with the optional title and description keys.
    r�c�(�g|]\}}|||jf��SrH)r�)r]�mr�s   r=r�z&models_json_schema.<locals>.<listcomp>�s&��
J�
J�
J���4�q�$��2�3�
J�
J�
Jr?rYr�rA)r�r@r$r�r�r�)
r�r�r�rAr�r�rUr��instancer�r�rVr�s
             r=�models_json_schemar�ls���6�1�1���Q��c�0�-�2J�K�K�	1��&�.�.�0�0�0������M�M�M�H�
J�
J�6�
J�
J�
J�F�$,�$A�$A�&�$I�$I�!��k�"$�K��+�*��G���%�$��G���1�%0��M�"��[�(�(r?.rn�Iterable[_JsonDict]r�c�X�td�|D�������S)Nc�.�i|]}t|��|��SrH��_make_json_hashable)r]r6s  r=r�z(_deduplicate_schemas.<locals>.<dictcomp>�s#��K�K�K��$�V�,�,�f�K�K�Kr?)rbr�)rns r=rere�s+���K�K�7�K�K�K�R�R�T�T�U�U�Ur?r��_Json�
_HashableJsonc��t|t��r8ttd�|���D������St|t
��rtd�|D����S|S)Nc3�>K�|]\}}|t|��fV��dSrvrrs   r=r`z&_make_json_hashable.<locals>.<genexpr>�s4����R�R�D�A�q�Q� 3�A� 6� 6�7�R�R�R�R�R�Rr?c3�4K�|]}t|��V��dSrvrrIs  r=r`z&_make_json_hashable.<locals>.<genexpr>�s+����;�;��(��+�+�;�;�;�;�;�;r?)r�r�r��sortedrdrb)r�s r=rr�su���%������V�R�R�E�K�K�M�M�R�R�R�R�R�S�S�S�	�E�4�	 �	 ���;�;�U�;�;�;�;�;�;��r?�
parent_keyc�H�t|t��rLi}|���}|dkrt|��}|D]}t	|||���||<�|St|t
��r+g}|D]$}|�t	|�����%|S|S)Nr�)r
)r�r�r�r	r�rbrc)r�r
�sorted_dictr�r��sorted_listr�s       r=r�r��s����%�����24���z�z�|�|����%�%��$�<�<�D��	M�	M�C�0��s���L�L�L�K������	�E�4�	 �	 ��-/���	8�	8�D����0��6�6�7�7�7�7����r?c�<�eZdZUdZded<dZded<dd
�Zdd�ZdS)�WithJsonSchemaa�Add this as an annotation on a field to override the (base) JSON schema that would be generated for that field.
    This provides a way to set a JSON schema for types that would otherwise raise errors when producing a JSON schema,
    such as Callable, or types that have an is-instance core schema, without needing to go so far as creating a
    custom subclass of pydantic.json_schema.GenerateJsonSchema.
    Note that any _modifications_ to the schema that would normally be made (such as setting the title for model fields)
    will still be performed.

    If `mode` is set this will only apply to that schema generation mode, allowing you
    to set different json schemas for validation and serialization.
    r�r�N�-Literal['validation', 'serialization'] | Noner�r�core_schema.CoreSchema�handlerr'r:r7c�t�|jp|j}||jkr||��S|j�t�|jSrv)r�r�r)ryrrr�s    r=�__get_pydantic_json_schema__z+WithJsonSchema.__get_pydantic_json_schema__�sG���y�(�G�L���7�<����7�;�'�'�'���#����#�#r?r�c�D�tt|j����Srv��hashr�r�r�s r=�__hash__zWithJsonSchema.__hash__�����D���O�O�$�$�$r?�rrrr'r:r7�r:r��rDrErFrGr�r�rrrHr?r=rr�sg�������	�	�(�'�'�'�:>�D�>�>�>�>�
$�
$�
$�
$�%�%�%�%�%�%r?rc�<�eZdZUdZded<dZded<dd
�Zdd�ZdS)�ExamplesaAdd examples to a JSON schema.

    Examples should be a map of example names (strings)
    to example values (any valid JSON).

    If `mode` is set this will only apply to that schema generation mode,
    allowing you to add different examples for validation and serialization.
    r9�examplesNrr�rrrr'r:r7c���|jp|j}||��}||jkr|S|�di��}|�t|j����||d<|S)Nr)r�rwr<rr)ryrrr�r�rs      r=rz%Examples.__get_pydantic_json_schema__�st���y�(�G�L���g�k�*�*���7�<������?�?�:�r�2�2�����*�4�=�9�9�:�:�:�"*��J���r?r�c�D�tt|j����Srvrr�s r=rzExamples.__hash__�rr?rrrrHr?r=rr�sg�������������:>�D�>�>�>�>�
�
�
�
�%�%�%�%�%�%r?rr�r	�set[JsonRef]c�^�t��}t|t��r�|���D]�\}}|dkr8t|t��r#|�t
|�����Ct|t��r#|�t|�����{t|t��r'|D]$}|�t|�����%��n<t|t��r'|D]$}|�t|�����%|S)z6Get all the definitions references from a JSON schema.r�)
r�r�r�rdr�r�rKr<r�rb)r��refsr�r�s    r=r�r��s%�����D��$����2��*�*�,�,�	:�	:�J�C���f�}�}��E�3�!7�!7�}��������(�(�(�(��E�4�(�(�
:����.�u�5�5�6�6�6�6��E�4�(�(�
:�!�:�:�D��K�K� 2�4� 8� 8�9�9�9�9��	:�
�D�$�	�	�2��	2�	2�D��K�K�*�4�0�0�1�1�1�1��Kr?�AnyTypec�*�eZdZdZdd�Zdd�Zdd
�ZdS)�SkipJsonSchemaa�Add this as an annotation on a field to skip generating a JSON schema for that field.

        Example:
            ```py
            from pydantic import BaseModel
            from pydantic.json_schema import SkipJsonSchema

            class Model(BaseModel):
                a: int | SkipJsonSchema[None] = None


            print(Model.model_json_schema())
            #> {'properties': {'a': {'default': None, 'title': 'A', 'type': 'integer'}}, 'title': 'Model', 'type': 'object'}
            ```
        r�r%r:c�0�t||��fSrv)r)rUr�s  r=�__class_getitem__z SkipJsonSchema.__class_getitem__*	s���T�3�3�5�5�[�)�)r?rrrr'r7c��t�rv)r)ryrrs   r=rz+SkipJsonSchema.__get_pydantic_json_schema__-	s
���r?r�c�:�tt|����Srv)rr�r�s r=rzSkipJsonSchema.__hash__2	s����T�
�
�#�#�#r?N)r�r%r:r%)rrrr'r:r7r)rDrErFrGr)rrrHr?r=r'r'	sZ������	�	� 	*�	*�	*�	*�	�	�	�	�
	$�	$�	$�	$�	$�	$r?r'r�r+c��tj|��j}|�d��}|�&	t	j|d��S#t$rYnwxYwiS)N�pydantic_typed_dict_clsr?)r r�r�rwr"�get_attribute_from_basesr�)r6r�rUs   r=r�r�6	sj���1�&�9�9�B�H�
�,�,�0�
1�
1�C�
��	��7��=R�S�S�S���	�	�	��D�	����
�Is�A�
A�A)r6r7r8r9r:r7rH)rUr�r�r�r�r�r�r�r�r�r:r9)r�r�r�r�r�r�rAr�r�r�r�r�r:r�)rnr�r:r�)r�rr:rrv)r�r7r
r�r:r7)r�r	r:r")r6r�r:r+)lrG�
__future__r�_annotations�dataclassesr(r
r�r��collectionsrr�rrrOr�typingrr	r
rrr
rrrrrrrrr�rrrr�pydantic_core.core_schemar�typing_extensionsrrr�	_internalrr r!r"r#r$r%r&�annotated_handlersr'r�r(�errorsr)r*r�r+�_internal._core_utilsr,r-�_internal._dataclassesr.�#_internal._schema_generation_sharedr/�mainr0�CoreSchemaType�CoreSchemaFieldTyper�r�r7r�r5r�r>r��UserWarningrCr�rIrJrKr�rL�	dataclass�
slots_truerOr�r�r�r�r%r�r�	_JsonDictrrerr�rrr�r%r'r�rHr?r=�<module>rCs������3�2�2�2�2�2�������������	�	�	�	�����#�#�#�#�#�#�������$�$�$�$�$�$���������������������������������������"����S�S�S�S�S�S�S�S�S�S�S�S�3�3�3�3�3�3�>�>�>�>�>�>�>�>�>�>�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�5�4�4�4�4�4�+�+�+�+�+�+�C�C�C�C�C�C�C�C�� �������I�I�I�I�I�I�I�I�9�9�9�9�9�9�J�J�J�J�J�J������� �� :�K�<[� [�\����s�C�x�.����6�7���AH�Zb�1c�1c��c�c�c�c�
�
�
�
�  � L�M������������)��A�
�'�)�S�
!�
!���'�)�S�
!�
!���'�)�S�
!�
!���G�^�+�,����)��:�:�:�����8�8�,�7�8�8�M�M�M�M�M�M�M�9�8�M�`ia�ia�ia�ia�ia�ia�ia�ia�b;�,�1C�'�W�W�W�W�W�B��"�,�1C�+)�+)�+)�+)�+)�+)�b	�d�3��8�n�d�3�i��c�5�$��D�E����e���	��e�E�#�s�(�O�S�0�1�5��c��?�C��e�UY�[_�_�`�
�V�V�V�V����������$���8�8�,�7�8�8�%�%�%�%�%�%�%�9�8�%�>���8�8�,�7�8�8�%�%�%�%�%�%�%�9�8�%�:����&�'�)�
�
���$��w��|�,�N�N��[��<�<�0�;�<�<�$�$�$�$�$�$�$�=�<�$�:�����r?

?>