title: Why isn't this a valid schema for Rx?
body: <p>I'm using YAML as a configuration file format for a Python project.</p>
  
  <p>Recently I found <a href="http://rjbs.manxome.org/rx/" rel="noreferrer">Rx</a> to be the only schema validator available for Python and YAML. :-/ <a href="http://www.kuwata-lab.com/kwalify/" rel="noreferrer">Kwalify</a> works with YAML, but it's only for Ruby and Java. :(</p>
  
  <p>I've been reading their lacking documentation all day and just can't seem to write a valid schema to represent my file structure. Help?</p>
  
  <p>I have the following YAML config file:</p>
  
  <pre><code>cmd:
    exec: mycmd
    aliases: [my, cmd]
    filter:
      sms: 'regex .*'
  
  load:
    exec: load
    filter:
      sms: 'load: .*$'
  
  echo:
    exec: echo %
  </code></pre>
  
  <p>I'm failing at representing a nested structure. What I want is for the outer-most item (cmd, load and echo, in this case) to be an arbitrary string that in turn contains other items. 'exec' is a fixed string and required item; 'aliases' and 'filter' are also fixed, but should be optional. Filter in turn has another set of required and optional items. How should I represent this with Rx?</p>
  
  <p>So far I have the following schema (in YAML), which Rx fails to compile:</p>
  
  <pre><code>type: //rec
  required:
    type: //rec
    required:
      exec: //str
    optional:
      aliases:
        type: //arr
        contents: //str
        length: {min: 1, max: 10}
      filter:
        type: //rec
        optional:
          sms: //str
          email: //str
          all: //str
  </code></pre>
  
  <p>Testing this in IPython gives me this:</p>
  
  <pre><code>/Rx.py in make_schema(self, schema)
       68       raise Error('invalid schema argument to make_schema')
       69
  ---&gt; 70     uri = self.expand_uri(schema["type"])
       71
       72     if not self.type_registry.get(uri): raise "unknown type %s" % uri
  
  KeyError: 'type'
  </code></pre>
  
  <p>Which leads me to believe I'm not specifying "type" somewhere. :-S</p>
  
  <p>Any ideas?</p>
  
  <p>I'm pretty tired fighting with this thing... Is there some other way I can write a schema and use it to validate my configuration files?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Ivan</p>