11import logging
2- from typing import Type , Union
2+ from typing import Type , Union , Any
33
44from . import SchemaFactory
55from ..enumeration import ContentType
@@ -21,15 +21,19 @@ def __init__(self, schema_factory: SchemaFactory, strict_enum: bool = True) -> N
2121
2222 def build_list (self , data : dict ) -> list [Content ]:
2323 return [
24- self ._create_content (content_type , content_value ['schema' ])
24+ self ._create_content (content_type , content_value .get ('schema' , {}),
25+ content_value .get ('example' , None ),
26+ content_value .get ('examples' , {}))
2527 for content_type , content_value
2628 in data .items ()
2729 ]
2830
29- def _create_content (self , content_type : str , content_value : dict ) -> Content :
31+ def _create_content (self , content_type : str , schema : dict , example : Any , examples : dict ) -> Content :
3032 logger .debug (f"Content building [type={ content_type } ]" )
3133 ContentTypeCls : ContentTypeType = ContentType if self .strict_enum else LooseContentType
3234 return Content (
3335 type = ContentTypeCls (content_type ),
34- schema = self .schema_factory .create (content_value )
36+ schema = self .schema_factory .create (schema ),
37+ example = example ,
38+ examples = examples
3539 )
0 commit comments