chpache
3 years agoVisitor
oneOf throws ValueError: Invalid value for ... on response parsing if not matching the last referenc
Hi there!
I'm using openapi 3.0.3 and I have an issue with my client: I expect an answer of the type Foo like
Foo: oneOf: - $ref: "#/components/schemas/Bar1" - $ref: "#/components/schemas/Bar2" discriminator: propertyName: type mapping: bar1: "#/components/schemas/Bar1" bar2: "#/components/schemas/Bar2"
And if my client receives Bar1, it will fail because in foo.py, there is a check for
allowed_values = ["bar2"]
Which throws:
ValueError: Invalid value for `type` (bar1), must be one of ['bar2']
I tested it a bit and it looks like it's taking the last ref in oneOf (Bar2).
Do you know how to fix it?