Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions aws_doc_sdk_examples_tools/doc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,15 @@ def validate(self):
)

def fill_missing_fields(self):
def safe_split_id(ex_id: str) -> Tuple[str, str]:
if "_" in example.id:
svc, act = ex_id.split("_", 1)
else:
svc, act = "unknown_service", "unknown_action"
return svc, act

for example in self.examples.values():
id_service, id_action = example.id.split("_", 1)
id_service, id_action = safe_split_id(example.id)
service_id = example.service_main or next(
(k for (k, _) in example.services.items()), None
)
Expand All @@ -274,7 +281,7 @@ def fill_missing_fields(self):
service_id = id_service
action = (
next((k for k in example.services.get(service_id, [])), None)
or example.id.split("_", 1)[1]
or safe_split_id(example.id)[1]
)
if action is None:
# TODO Log and find which tributaries this effects, as it was supposed to be caught by validations.
Expand Down
Loading