Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid KeyError when attempting to access "properties" key #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions openapi2jsonschema/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def default(output, schema, prefix, stand_alone, expanded, kubernetes, strict):
# For Kubernetes, populate `apiVersion` and `kind` properties from `x-kubernetes-group-version-kind`
for type_name in definitions:
type_def = definitions[type_name]
if "properties" not in type_def:
error(f"{type_name} has no properties")
continue

if "x-kubernetes-group-version-kind" in type_def:
for kube_ext in type_def["x-kubernetes-group-version-kind"]:
if expanded and "apiVersion" in type_def["properties"]:
Expand Down