diff --git a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml index b77ff51d4bae..e0f1475ea83d 100644 --- a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1640,6 +1640,20 @@ components: required: - id - activity + DiscriminatorAllOfSuper: + type: object + required: + - elementType + discriminator: + propertyName: elementType + properties: + elementType: + type: string + DiscriminatorAllOfSub: + allOf: + - $ref: '#/components/schemas/DiscriminatorAllOfSuper' + - type: object + properties: {} Pet: type: object required: diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index e67ae8fb6538..7e284d7b19b6 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -342,6 +342,11 @@ def test_inheritance(self): self.assertEqual(dog2.breed, 'bulldog') self.assertEqual(dog2.class_name, "dog") self.assertEqual(dog2.color, 'white') + + def test_inheritance_discriminators(self): + petstore_api.DiscriminatorAllOfSuper.from_dict({"className": "dog", "color": "white", "breed": "bulldog"}) + + def test_list(self): # should throw exception as var_123_list should be string