I am using YAML as the configuration file format for a Python project.
I recently found Rx to be the only schema validator available for Python and YAML.: - / Kwalify works with YAML, but it is only for Ruby and Java . :(
I read their missing documentation all day and just can't write the right schema to represent my file structure. Help?
I have the following YAML configuration file:
cmd:
exec: mycmd
aliases: [my, cmd]
filter:
sms: 'regex .*'
load:
exec: load
filter:
sms: 'load: .*$'
echo:
exec: echo %
. , (cmd, load echo, ) , , , . "exec" - ; "" "" , . , , . Rx?
( YAML), Rx :
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
IPython :
/Rx.py in make_schema(self, schema)
68 raise Error('invalid schema argument to make_schema')
69
---> 70 uri = self.expand_uri(schema["type"])
71
72 if not self.type_registry.get(uri): raise "unknown type %s" % uri
KeyError: 'type'
, "" -.: -S
?
, ... ?
,