Skip to content

Commit

Permalink
[Python-experimental] Fix type error if oneof/anyof child schema is n…
Browse files Browse the repository at this point in the history
…ull type (#6387)

* Mustache template should use invokerPackage tag to generate import

* Fix runtime exception when composed schema has 'null' type

* Fix runtime exception when composed schema has 'null' type
  • Loading branch information
sebastien-rosset authored May 25, 2020
1 parent afb3188 commit 583aa24
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def get_discriminator_class(model_class,
model_class._composed_schemas.get('allOf', ())
for cls in composed_children:
# Check if the schema has inherited discriminators.
if cls.discriminator is not None:
if hasattr(cls, 'discriminator') and cls.discriminator is not None:
used_model_class = get_discriminator_class(
cls, discr_name, discr_value, cls_visited)
if used_model_class is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def get_discriminator_class(model_class,
model_class._composed_schemas.get('allOf', ())
for cls in composed_children:
# Check if the schema has inherited discriminators.
if cls.discriminator is not None:
if hasattr(cls, 'discriminator') and cls.discriminator is not None:
used_model_class = get_discriminator_class(
cls, discr_name, discr_value, cls_visited)
if used_model_class is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def get_discriminator_class(model_class,
model_class._composed_schemas.get('allOf', ())
for cls in composed_children:
# Check if the schema has inherited discriminators.
if cls.discriminator is not None:
if hasattr(cls, 'discriminator') and cls.discriminator is not None:
used_model_class = get_discriminator_class(
cls, discr_name, discr_value, cls_visited)
if used_model_class is not None:
Expand Down

0 comments on commit 583aa24

Please sign in to comment.