I have a related but slightly tangential solution, which has taken me a while to work out. I am not 100% in control of the swagger schema generation for my API, and in any case, I care more that the API's swagger spec complies with 2.0 than that my validation of the API responses is easy.
So, I don't wish to use "oneOf" or anything like that - I simply want to customize the schema validation. The documentation is not too clear about how to do this, but this seems to work:
validator3 = Draft3Validator(swagger_spec, types={'string': (str, type(None))})
And, since keywords are passed on to jsonschema.validate(), we can also do:
jsonschema.validate(instance, schema, types={'string': (str, type(None))})
I prefer the former, especially as I make it a method on my unittest class, e.g. self.should_match_schema(data, path)