K
kwatch
I have released Kwalify 0.6.0.
http://www.kuwata-lab.com/kwalify
Kwalify is a schema validator for YAML and JSON.
Example:
schema.yaml : example of schema file
--------------------
type: seq
sequence:
- type: map
mapping:
"name": { type: str, required: yes }
"email": { type: str, pattern: /@/ }
"birth": { type: date }
"blood": { type: str, enum: [A, B, O, AB] }
--------------------
data1.yaml: example of valid YAML file
--------------------
- name: Foo
email: (e-mail address removed)
birth: 1980-01-01
- name: Bar
email: (e-mail address removed)
blood: A
--------------------
valdation:
====================
$ kwalify -lf schema.yaml data1.yaml
data1.yaml#0: valid.
====================
data2.yaml: example of invalid YAML file
--------------------
- name: Foo
email: foo.mail.com
birth: 1980/01/01
- naem: Bar
email: (e-mail address removed)
blood: a
--------------------
validation:
====================
$ kwalify -lf schema.yaml data2.yaml
- (line 2) [/0/email] 'foo.mail.com': not matched to pattern /@/.
- (line 3) [/0/birth] '1980/01/01': not a date.
- (line 4) [/1/naem] key 'naem:' is undefined.
- (line 4) [/1] key 'name:' is required.
- (line 6) [/1/blood] 'a': invalid blood value.
====================
Changes from 0.5.1:
[enhances]
* Class definition generation support.
New command-line option '-a genclass-ruby' or '-a genclass-java'
generates class definitions in Ruby or Java from schema file.
See users' guide for details.
http://www.kuwata-lab.com/kwalify
Kwalify is a schema validator for YAML and JSON.
Example:
schema.yaml : example of schema file
--------------------
type: seq
sequence:
- type: map
mapping:
"name": { type: str, required: yes }
"email": { type: str, pattern: /@/ }
"birth": { type: date }
"blood": { type: str, enum: [A, B, O, AB] }
--------------------
data1.yaml: example of valid YAML file
--------------------
- name: Foo
email: (e-mail address removed)
birth: 1980-01-01
- name: Bar
email: (e-mail address removed)
blood: A
--------------------
valdation:
====================
$ kwalify -lf schema.yaml data1.yaml
data1.yaml#0: valid.
====================
data2.yaml: example of invalid YAML file
--------------------
- name: Foo
email: foo.mail.com
birth: 1980/01/01
- naem: Bar
email: (e-mail address removed)
blood: a
--------------------
validation:
====================
$ kwalify -lf schema.yaml data2.yaml
- (line 2) [/0/email] 'foo.mail.com': not matched to pattern /@/.
- (line 3) [/0/birth] '1980/01/01': not a date.
- (line 4) [/1/naem] key 'naem:' is undefined.
- (line 4) [/1] key 'name:' is required.
- (line 6) [/1/blood] 'a': invalid blood value.
====================
Changes from 0.5.1:
[enhances]
* Class definition generation support.
New command-line option '-a genclass-ruby' or '-a genclass-java'
generates class definitions in Ruby or Java from schema file.
See users' guide for details.