Skip to content

Commit

Permalink
openapijson2schema/command.py: throw error instead of proceeding
Browse files Browse the repository at this point in the history
Borrowed from instrumenta#62
  • Loading branch information
hectorm committed Feb 3, 2024
1 parent f48dd6a commit 22b66c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/openapi2jsonschema/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def default(output, schema, prefix, stand_alone, expanded, kubernetes, strict):
version = data["swagger"]
elif "openapi" in data:
version = data["openapi"]
else:
raise ValueError(
"Cannot convert data to JSON because we could not find 'openapi' or 'swagger' keys"
)

if not os.path.exists(output):
os.makedirs(output)
Expand Down

0 comments on commit 22b66c8

Please sign in to comment.