title: json schema validation does not work for dependencies?
body: <p>As far as I understand, using:</p>
  <pre><code>    dependencies:
        cake:
          - eggs
          - flour
  </code></pre>
  <p>in a JSON schema validation (I actually parse the schema in YAML, but it should not really matter) should forbid the presence of a cake without an entry for eggs and flour. So this should be rejected:</p>
  <pre><code>receip:
    cake: crepes
  </code></pre>
  <p>while this should be accepted:</p>
  <pre><code>receip:
    eggs: 3 eggs, given by farmer
    flour: 500g
    cake: crepes
  </code></pre>
  <p>Unfortunately, both cases are accepted in my case. Any idea what I made wrong? I also tried to add another level <code>required</code> as proposed by <a href="https://stackoverflow.com/questions/38717933/jsonschema-attribute-conditionally-required">jsonSchema attribute conditionally required</a> but the problem is the same.</p>
  <p><strong>MWE</strong>
  In case it helps, here are all the files that I'm using.</p>
  <p><code>debug_schema.yml</code>:</p>
  <pre><code>$schema: https://json-schema.org/draft/2020-12/schema
  type: object
  properties:
    receip:
      type: object
      properties:
        eggs:
          type: string
        flour:
          type: string
        cake:
          type: string
      dependencies:
        cake:
          - eggs
          - flour
  </code></pre>
  <p>b.yml:</p>
  <pre><code>receip:
    ## I'd like to forbid a cake without eggs and flour
    ## Should not validate until I uncomment:
    # eggs: 3 eggs, given by farmer
    # flour: 500g
    cake: crepes
  </code></pre>
  <p><code>validate_yaml.py</code></p>
  <pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
  import yaml
  from jsonschema import validate, ValidationError
  import argparse
  
  # Instantiate the parser
  parser = argparse.ArgumentParser(description='This tool not only checks if the YAML file is correct in term'
                                   + ' of syntex, but it also checks if the structure of the YAML file follows'
                                   + ' the expectations of this project (e.g. that it contains a list of articles,'
                                   + ' with each articles having a title etc…).')
  # Optional argument
  parser.add_argument('--schema', type=str, default=&quot;schema.yml&quot;,
                      help='Path to the schema')
  
  parser.add_argument('--yaml', type=str, default=&quot;science_zoo.yml&quot;,
                      help='Path to the YAML file to verify')
  
  args = parser.parse_args()
  
  class YAMLNotUniqueKey(Exception):
      pass
  
  
  # By default, PyYAML does not raise an error when two keys are identical, which is an issue here
  # see https://github.com/yaml/pyyaml/issues/165#issuecomment-430074049
  class UniqueKeyLoader(yaml.SafeLoader):
      def construct_mapping(self, node, deep=False):
          mapping = set()
          for key_node, value_node in node.value:
              key = self.construct_object(key_node, deep=deep)
              if key in mapping:
                  raise YAMLNotUniqueKey(f&quot;Duplicate key {key!r} found.&quot;)
              mapping.add(key)
          return super().construct_mapping(node, deep)
      
  with open(args.schema, &quot;r&quot;) as schema_stream:
      try:
          schema = yaml.load(schema_stream, UniqueKeyLoader)
          with open(args.yaml, &quot;r&quot;) as yaml_stream:
              try: 
                  validate(yaml.load(yaml_stream, UniqueKeyLoader), schema)
                  print(&quot;The YAML file is correct and follows the schema, congrats! :D&quot;)
              except ValidationError as exc:
                  print(exc.message)
                  print(&quot;The problem is located in the JSON at the path {}.&quot;.format(exc.json_path))
              except YAMLNotUniqueKey as exc:
                  print(&quot;ERROR: {}&quot;.format(exc))
                  print(&quot;Rename in the YAML one the two instances of this key to ensure all keys are unique.&quot;)
              except yaml.YAMLError as exc:
                  print(&quot;Errors when trying to load the YAML file:&quot;)
                  print(exc)
  
      except YAMLNotUniqueKey as exc:
          print(&quot;ERROR: {}&quot;.format(exc))
          print(&quot;Rename in the schema one the two instances of this key to ensure all keys are unique.&quot;)
      except yaml.YAMLError as exc:
          print(&quot;Errors when trying to load the schema file:&quot;)
          print(exc)
  </code></pre>
  <p>Command:</p>
  <pre><code>./validate_yaml.py --yaml b.yml --schema debug_schema.yml 
  </code></pre>