feat: minor adjustments to oneOf and adds tests for examples in allOf, oneOf, anyOf

This commit is contained in:
2025-11-23 20:03:19 -03:00
parent ffbd124cf9
commit e43e92cb9e
3 changed files with 96 additions and 3 deletions

View File

@@ -45,8 +45,7 @@ class OneOfTypeParser(GenericTypeParser):
# they were added by OpenAPI and not all implementations may support them,
# and they do not always generate a model one-to-one to the Pydantic model
# TL;DR: Discriminators were added by OpenAPI and not a Official JSON Schema feature
discriminator = properties.get("discriminator")
if discriminator is not None:
if (discriminator := properties.get("discriminator")) is not None:
validated_type = self._build_type_one_of_with_discriminator(
subfield_types, discriminator
)