Repository: cloud-custodian/cloud-custodian

Issue:
aws - filters - "missing" filter throw an error running on lambda function
**Describe the bug**
While updating from 0.8 to 0.9 I faced an issue with some of my rules. When I use a _missing_ filter in a policy deployed on a lambda function.

**To Reproduce**
Deploy the Lambda function and create an ACM certificate, then delete it
you can find the error of the lambda function in cloudwatch

**Expected behavior**
The lambda function has a correct execution.


**Background (please complete the following information):**
 - OS: AWS Lambda
 - Python Version: 3.7
 - Custodian Version: 0.9.2
 - Tool Version: 0.9.2
 - Cloud Provider: aws
 - Policy: 
```yaml
policies: 
  - name: certificate-deleted
    resource: account
    filters:
      - type: missing
        policy:
            resource: acm-certificate
            filters:
              - type: value
                key: certificateArn
                op: eq
                value: "detail.requestParameters.certificateArn"
    mode:
      function-prefix: "SEC-c7n-"
      type: cloudtrail
      role: YOURROLE
      events:
        - source: acm.amazonaws.com
          event: DeleteCertificate
          ids: requestParameters.certificateArn
    actions:
      - type: post-finding
        severity_normalized: 1
        types:
          - "Unusual Behaviors/SEC"
        compliance_status: WARNING
        recommendation: "SEC"
```
 - Traceback: 
```
[ERROR] RuntimeError: missing jsonschema dependency
Traceback (most recent call last):
  File "/var/task/custodian_policy.py", line 4, in run
    return handler.dispatch_event(event, context)
  File "/var/task/c7n/handler.py", line 175, in dispatch_event
    p.validate()
  File "/var/task/c7n/policy.py", line 1047, in validate
    f.validate()
  File "/var/task/c7n/filters/missing.py", line 49, in validate
    collection = PolicyLoader(
  File "/var/task/c7n/loader.py", line 136, in load_data
    errors = self.validator.validate(policy_data, tuple(rtypes))
  File "/var/task/c7n/loader.py", line 47, in validate
    self.gen_schema(tuple(sorted(resource_types)))
  File "/var/task/c7n/loader.py", line 74, in gen_schema
    self.validator = v = self._gen_schema(resource_types)
  File "/var/task/c7n/loader.py", line 82, in _gen_schema
    raise RuntimeError("missing jsonschema dependency")
```




Discussion:
This error seems to occur only running on lambda function, due to a missing library : jsonschema, but was working properly in c7n==0.8.45
thanks for reporting

Resolving patch:
diff --git a/c7n/loader.py b/c7n/loader.py
--- a/c7n/loader.py
+++ b/c7n/loader.py
@@ -130,9 +130,9 @@ def load_data(self, policy_data, file_uri, validate=None,
         if missing:
             self._handle_missing_resources(policy_data, missing)
 
-        if validate is not False or (
+        if schema and (validate is not False or (
                 validate is None and
-                self.default_schema_validate):
+                self.default_schema_validate)):
             errors = self.validator.validate(policy_data, tuple(rtypes))
             if errors:
                 raise PolicyValidationError(


Test patch: