@@ -30,9 +30,27 @@ def example_from_yaml(
3030) -> Tuple [Example , MetadataErrors ]:
3131 errors = MetadataErrors ()
3232
33- title = get_with_valid_entities ("title" , yaml , errors , True )
34- title_abbrev = get_with_valid_entities ("title_abbrev" , yaml , errors , True )
35- synopsis = get_with_valid_entities ("synopsis" , yaml , errors , opt = True )
33+ title = get_field (
34+ name = "title" ,
35+ d = yaml ,
36+ errors = errors ,
37+ opt = True ,
38+ check_aws = validation .check_aws ,
39+ )
40+ title_abbrev = get_field (
41+ name = "title_abbrev" ,
42+ d = yaml ,
43+ errors = errors ,
44+ opt = True ,
45+ check_aws = validation .check_aws ,
46+ )
47+ synopsis = get_field (
48+ name = "synopsis" ,
49+ d = yaml ,
50+ errors = errors ,
51+ opt = True ,
52+ check_aws = validation .check_aws ,
53+ )
3654 synopsis_list = [str (syn ) for syn in yaml .get ("synopsis_list" , [])]
3755
3856 source_key = yaml .get ("source_key" )
@@ -123,16 +141,20 @@ def excerpt_from_yaml(yaml: Any) -> Tuple["Excerpt", MetadataErrors]:
123141 return (Excerpt (description , snippet_tags , snippet_files , genai ), errors )
124142
125143
126- def get_with_valid_entities (
127- name : str , d : Dict [str , str ], errors : MetadataErrors , opt : bool = False
144+ def get_field (
145+ name : str ,
146+ d : Dict [str , str ],
147+ errors : MetadataErrors ,
148+ opt : bool = False ,
149+ check_aws = True ,
128150) -> str :
129151 field = d .get (name )
130152 if field is None :
131153 if not opt :
132154 errors .append (metadata_errors .MissingField (field = name ))
133155 return ""
134156
135- checker = StringExtension ()
157+ checker = StringExtension (check_aws = check_aws )
136158 if not checker .is_valid (field ):
137159 errors .append (
138160 metadata_errors .AwsNotEntity (
@@ -195,7 +217,7 @@ def parse_services(yaml: Any, errors: MetadataErrors) -> Dict[str, Set[str]]:
195217
196218
197219def url_from_yaml (
198- yaml : Union [None , Dict [str , Optional [str ]]]
220+ yaml : Union [None , Dict [str , Optional [str ]]],
199221) -> Optional [Union [Url , MetadataParseError ]]:
200222 if yaml is None :
201223 return None
@@ -209,7 +231,7 @@ def url_from_yaml(
209231
210232
211233def person_from_yaml (
212- yaml : Union [None , Dict [str , Optional [str ]]]
234+ yaml : Union [None , Dict [str , Optional [str ]]],
213235) -> Optional [Union [Person , MetadataParseError ]]:
214236 if yaml is None :
215237 return None
0 commit comments