openapi-core/openapi_core/casting/schemas/util.py

11 lines
224 B
Python
Raw Normal View History

2020-01-23 22:48:34 +00:00
"""OpenAPI core casting schemas util module"""
from distutils.util import strtobool
from six import string_types
def forcebool(val):
if isinstance(val, string_types):
val = strtobool(val)
return bool(val)