def is_valid ( data ) : return bool ( data ) and isinstance ( data , dict ) and bool ( data . get ( "swagger" ) ) and isinstance ( data . get ( 'paths' ) , dict )
python validate json is list or dictionary
Checks if the input data is a Swagger document
def is_valid(data):
        """
        Checks if the input data is a Swagger document

        :param dict data: Data to be validated
        :return: True, if data is a Swagger
        """
        return bool(data) and \
            isinstance(data, dict) and \
            bool(data.get("swagger")) and \
            isinstance(data.get('paths'), dict)