[Python-experimental] Fix type error if oneof/anyof child schema is null 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
This commit is contained in:
Sebastien Rosset 2020-05-24 17:21:00 -07:00 committed by GitHub
parent afb3188fab
commit 583aa24152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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: