o
    ã¥µi  ã                   @  s8   d dl mZ d dlZddlmZ dd	d
„Zddd„ZdS )é    )ÚannotationsNé   )ÚViewTypeÚoperation_infoútyping.Dict[str, typing.Any]Ú	more_infoÚreturnc                 C  sx   |  ¡ D ]5\}}|| v r5t| | tjƒr$t| | ƒ | |< }| |¡ qt| | tƒr5t| | |ƒ| |< q|| |< q| S )N)ÚitemsÚ
isinstanceÚtypingÚSequenceÚlistÚextendÚdictÚmerge_openapi_info)r   r   ÚkeyÚvalueÚ_© r   úJ/home/ubuntu/.local/lib/python3.10/site-packages/kui/openapi/extra_docs.pyr      s   

r   Úhandlerr   Úinfoc                 C  sr   t | tƒr$t| dƒD ]}t| | ¡ ƒ}tt|di ƒ|ƒ}t|d|ƒ q
ntt| di ƒ|ƒ}t| d|ƒ t t| ¡S )z”
    describe more openapi info in HTTP handler

    https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#operationObject
    Ú__methods__Ú__docs_extra__)	r
   ÚtypeÚgetattrÚlowerr   Úsetattrr   Úcastr   )r   r   ÚmethodÚhandler_methodÚ__extra_docs__r   r   r   Údescribe_extra_docs   s   
ÿûÿr"   )r   r   r   r   r   r   )r   r   r   r   r   r   )Ú
__future__r   r   Úroutingr   r   r"   r   r   r   r   Ú<module>   s
    
