From 66038bee3a3598eefd011d3bea19d7296e3dd7bc Mon Sep 17 00:00:00 2001 From: David Montague <35119617+dmontagu@users.noreply.github.com> Date: Fri, 28 Jul 2023 19:35:45 -0600 Subject: [PATCH] Remove xfail for discriminated union with alias (#6938) --- tests/test_json_schema.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_json_schema.py b/tests/test_json_schema.py index 480694d5cd..e3d773b661 100644 --- a/tests/test_json_schema.py +++ b/tests/test_json_schema.py @@ -3893,7 +3893,6 @@ class Model(BaseModel): } -@pytest.mark.xfail(reason='json schema generation for tagged unions is fundamentally incompatible with references') def test_alias_same(): class Cat(BaseModel): pet_type: Literal['cat'] = Field(alias='typeOfPet') @@ -3934,7 +3933,7 @@ class Model(BaseModel): 'pet': { 'oneOf': [{'$ref': '#/$defs/Cat'}, {'$ref': '#/$defs/Dog'}], 'title': 'Pet', - 'discriminator': 'something', + 'discriminator': {'mapping': {'cat': '#/$defs/Cat', 'dog': '#/$defs/Dog'}, 'propertyName': 'typeOfPet'}, }, }, 'required': ['pet', 'number'],