Skip to content

Commit

Permalink
Avoid IndexError when definition titles have less than 3 components
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorm committed Feb 3, 2024
1 parent caeaa15 commit f48dd6a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/openapi2jsonschema/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,12 @@ def default(output, schema, prefix, stand_alone, expanded, kubernetes, strict):
for title in components:
kind = title.split(".")[-1].lower()
if kubernetes:
group = title.split(".")[-3].lower()
api_version = title.split(".")[-2].lower()
try:
group = title.split(".")[-3].lower()
api_version = title.split(".")[-2].lower()
except IndexError:
error("Unable to determine group and apiVersion from %s" % title)
continue

specification = components[title]
specification["$schema"] = json_validator.META_SCHEMA["$schema"]
Expand Down

0 comments on commit f48dd6a

Please sign in to comment.