File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
aws_doc_sdk_examples_tools Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,7 @@ def from_yaml(
320320 if category == "" :
321321 category = "Api" if len (parsed_services ) == 1 else "Cross"
322322 is_action = category == "Api"
323+ is_basics = category == "Basics"
323324
324325 if is_action :
325326 svc_actions = []
@@ -337,6 +338,10 @@ def from_yaml(
337338 if is_action :
338339 if title or title_abbrev or synopsis or synopsis_list :
339340 errors .append (metadata_errors .APICannotHaveTitleFields ())
341+ elif is_basics :
342+ # Basics examples can have custom titles or no titles (in this case they're generated).
343+ if not (synopsis or synopsis_list ):
344+ errors .append (metadata_errors .BasicsMustHaveSynopsisField ())
340345 else :
341346 if not (title and title_abbrev and (synopsis or synopsis_list )):
342347 errors .append (metadata_errors .NonAPIMustHaveTitleFields ())
Original file line number Diff line number Diff line change @@ -281,6 +281,15 @@ def message(self):
281281 )
282282
283283
284+ @dataclass
285+ class BasicsMustHaveSynopsisField (MetadataParseError ):
286+ def message (self ):
287+ return (
288+ "is a Basics example and does not define synopsis or synopsis_list. "
289+ "Basics examples must define one of these fields."
290+ )
291+
292+
284293@dataclass
285294class MissingSnippetTag (SdkVersionError ):
286295 tag : str = ""
Original file line number Diff line number Diff line change @@ -348,6 +348,20 @@ def test_parse_strict_titles():
348348 - test.excerpt
349349 services:
350350 medical-imaging: {BadOne}
351+ medical-imaging_BadBasics:
352+ category: Basics
353+ languages:
354+ C++:
355+ versions:
356+ - sdk_version: 1
357+ github: cpp/example_code/medical-imaging
358+ sdkguide: sdkguide/link
359+ excerpts:
360+ - description: test excerpt description
361+ snippet_tags:
362+ - test.excerpt
363+ services:
364+ medical-imaging: {BadOne}
351365"""
352366
353367
@@ -374,6 +388,10 @@ def test_parse_strict_title_errors():
374388 file = Path ("test_cpp.yaml" ),
375389 id = "medical-imaging_BadScenario" ,
376390 ),
391+ metadata_errors .BasicsMustHaveSynopsisField (
392+ file = Path ("test_cpp.yaml" ),
393+ id = "medical-imaging_BadBasics" ,
394+ ),
377395 ]
378396 assert expected == [* errors ]
379397
You can’t perform that action at this time.
0 commit comments