99 Url ,
1010 Version ,
1111 Excerpt ,
12+ Person ,
13+ FeedbackCti ,
1214)
1315from .sdks import Sdk
1416from .services import Service
@@ -204,6 +206,37 @@ def url_from_yaml(
204206 return Url (title , url )
205207
206208
209+ def person_from_yaml (
210+ yaml : Union [None , Dict [str , Optional [str ]]]
211+ ) -> Optional [Union [Person , MetadataParseError ]]:
212+ if yaml is None :
213+ return None
214+ name = yaml .get ("name" )
215+ alias = yaml .get ("alias" )
216+
217+ if name is None or alias is None :
218+ return metadata_errors .PersonMissingField (name = str (name ), alias = str (alias ))
219+
220+ return Person (name , alias )
221+
222+
223+ def feedback_cti_from_yaml (
224+ yaml : Union [None , Dict [str , Optional [str ]]]
225+ ) -> Optional [Union [FeedbackCti , MetadataParseError ]]:
226+ if yaml is None :
227+ return None
228+ category = yaml .get ("category" )
229+ type = yaml .get ("type" )
230+ item = yaml .get ("item" )
231+
232+ if category is None or type is None or item is None :
233+ return metadata_errors .InvalidFeedbackCti (
234+ feedback_cti = "|" .join ([str (category ), str (type ), str (item )])
235+ )
236+
237+ return FeedbackCti (category , type , item )
238+
239+
207240def version_from_yaml (
208241 yaml : Dict [str , Any ],
209242 cross_content_blocks : Set [str ],
@@ -243,6 +276,19 @@ def version_from_yaml(
243276 elif url is not None :
244277 errors .append (url )
245278
279+ authors : List [Person ] = []
280+ for author in yaml .get ("authors" , []):
281+ author = person_from_yaml (author )
282+ if isinstance (author , Person ):
283+ authors .append (author )
284+ elif author is not None :
285+ errors .append (author )
286+
287+ owner = feedback_cti_from_yaml (yaml .get ("owner" ))
288+ if owner is not None and not isinstance (owner , FeedbackCti ):
289+ errors .append (owner )
290+ owner = None
291+
246292 add_services = parse_services (yaml .get ("add_services" , {}), errors )
247293 if add_services :
248294 errors .append (
@@ -264,6 +310,8 @@ def version_from_yaml(
264310 github ,
265311 sdkguide ,
266312 more_info ,
313+ authors ,
314+ owner ,
267315 ),
268316 errors ,
269317 )
0 commit comments