Skip to content

Commit 22b66c8

Browse files
committed
openapijson2schema/command.py: throw error instead of proceeding
Borrowed from instrumenta#62
1 parent f48dd6a commit 22b66c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/openapi2jsonschema/command.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ def default(output, schema, prefix, stand_alone, expanded, kubernetes, strict):
7676
version = data["swagger"]
7777
elif "openapi" in data:
7878
version = data["openapi"]
79+
else:
80+
raise ValueError(
81+
"Cannot convert data to JSON because we could not find 'openapi' or 'swagger' keys"
82+
)
7983

8084
if not os.path.exists(output):
8185
os.makedirs(output)

0 commit comments

Comments
 (0)