dc-kwalify 0.7.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/contrib/kwalify +1 -1
  4. data/dc-kwalify.gemspec +27 -0
  5. data/lib/kwalify/main.rb +1 -1
  6. data/lib/kwalify/util/testcase-helper.rb +1 -1
  7. data/lib/kwalify/version.rb +5 -0
  8. data/lib/kwalify.rb +1 -7
  9. metadata +83 -203
  10. data/setup.rb +0 -1585
  11. data/test/Rookbook.yaml +0 -10
  12. data/test/data/users-guide/AddressBook.java.expected +0 -40
  13. data/test/data/users-guide/BABEL.data.yaml +0 -24
  14. data/test/data/users-guide/BABEL.schema.yaml +0 -30
  15. data/test/data/users-guide/ExampleAddressBook.java +0 -47
  16. data/test/data/users-guide/Group.java.expected +0 -24
  17. data/test/data/users-guide/Person.java.expected +0 -44
  18. data/test/data/users-guide/address_book.rb +0 -52
  19. data/test/data/users-guide/address_book.schema.yaml +0 -28
  20. data/test/data/users-guide/address_book.yaml +0 -27
  21. data/test/data/users-guide/answers-schema.yaml +0 -12
  22. data/test/data/users-guide/answers-validator.rb +0 -52
  23. data/test/data/users-guide/babel_genclass.result +0 -26
  24. data/test/data/users-guide/config.schema.yaml +0 -7
  25. data/test/data/users-guide/config.yaml +0 -4
  26. data/test/data/users-guide/document01a.yaml +0 -3
  27. data/test/data/users-guide/document01b.yaml +0 -3
  28. data/test/data/users-guide/document02a.yaml +0 -4
  29. data/test/data/users-guide/document02b.yaml +0 -4
  30. data/test/data/users-guide/document03a.yaml +0 -6
  31. data/test/data/users-guide/document03b.yaml +0 -6
  32. data/test/data/users-guide/document04a.yaml +0 -9
  33. data/test/data/users-guide/document04b.yaml +0 -9
  34. data/test/data/users-guide/document05a.yaml +0 -11
  35. data/test/data/users-guide/document05b.yaml +0 -12
  36. data/test/data/users-guide/document06a.yaml +0 -15
  37. data/test/data/users-guide/document06b.yaml +0 -16
  38. data/test/data/users-guide/document07a.yaml +0 -9
  39. data/test/data/users-guide/document07b.yaml +0 -7
  40. data/test/data/users-guide/document12a.json +0 -10
  41. data/test/data/users-guide/document12b.json +0 -6
  42. data/test/data/users-guide/document13a.yaml +0 -17
  43. data/test/data/users-guide/document14a.yaml +0 -3
  44. data/test/data/users-guide/document14b.yaml +0 -3
  45. data/test/data/users-guide/document15a.yaml +0 -6
  46. data/test/data/users-guide/document15b.yaml +0 -5
  47. data/test/data/users-guide/example_address_book.rb +0 -10
  48. data/test/data/users-guide/example_address_book_java.result +0 -32
  49. data/test/data/users-guide/example_address_book_ruby.result +0 -31
  50. data/test/data/users-guide/genclass_java.result +0 -4
  51. data/test/data/users-guide/howto-validation-with-parsing.rb +0 -28
  52. data/test/data/users-guide/howto-validation.rb +0 -25
  53. data/test/data/users-guide/howto3.rb +0 -6
  54. data/test/data/users-guide/howto3.result +0 -5
  55. data/test/data/users-guide/howto3.yaml +0 -8
  56. data/test/data/users-guide/howto5_databinding.result +0 -111
  57. data/test/data/users-guide/invalid01.result +0 -3
  58. data/test/data/users-guide/invalid02.result +0 -5
  59. data/test/data/users-guide/invalid03.result +0 -5
  60. data/test/data/users-guide/invalid04.result +0 -4
  61. data/test/data/users-guide/invalid05.result +0 -11
  62. data/test/data/users-guide/invalid06.result +0 -4
  63. data/test/data/users-guide/invalid07.result +0 -3
  64. data/test/data/users-guide/invalid08.result +0 -3
  65. data/test/data/users-guide/invalid12.json +0 -8
  66. data/test/data/users-guide/invalid14.result +0 -4
  67. data/test/data/users-guide/invalid15.result +0 -4
  68. data/test/data/users-guide/loadbabel.rb +0 -27
  69. data/test/data/users-guide/loadconfig.rb +0 -16
  70. data/test/data/users-guide/loadconfig.result +0 -6
  71. data/test/data/users-guide/models.rb +0 -22
  72. data/test/data/users-guide/option_ha.result +0 -6
  73. data/test/data/users-guide/option_ha_genclass_java.result +0 -7
  74. data/test/data/users-guide/schema01.yaml +0 -3
  75. data/test/data/users-guide/schema02.yaml +0 -12
  76. data/test/data/users-guide/schema03.yaml +0 -9
  77. data/test/data/users-guide/schema04.yaml +0 -20
  78. data/test/data/users-guide/schema05.yaml +0 -29
  79. data/test/data/users-guide/schema06.yaml +0 -11
  80. data/test/data/users-guide/schema12.json +0 -12
  81. data/test/data/users-guide/schema13.yaml +0 -13
  82. data/test/data/users-guide/schema14.yaml +0 -5
  83. data/test/data/users-guide/schema15.yaml +0 -21
  84. data/test/data/users-guide/valid01.result +0 -2
  85. data/test/data/users-guide/valid02.result +0 -2
  86. data/test/data/users-guide/valid03.result +0 -2
  87. data/test/data/users-guide/valid04.result +0 -2
  88. data/test/data/users-guide/valid05.result +0 -2
  89. data/test/data/users-guide/valid06.result +0 -2
  90. data/test/data/users-guide/valid07.result +0 -2
  91. data/test/data/users-guide/valid08.result +0 -2
  92. data/test/data/users-guide/valid12.result +0 -2
  93. data/test/data/users-guide/valid13.result +0 -2
  94. data/test/data/users-guide/valid14.result +0 -2
  95. data/test/data/users-guide/valid15.result +0 -2
  96. data/test/data/users-guide/validate08.rb +0 -37
  97. data/test/test-action.rb +0 -78
  98. data/test/test-action.yaml +0 -738
  99. data/test/test-databinding.rb +0 -83
  100. data/test/test-databinding.yaml +0 -339
  101. data/test/test-main.rb +0 -157
  102. data/test/test-main.yaml +0 -415
  103. data/test/test-metavalidator.rb +0 -80
  104. data/test/test-metavalidator.yaml +0 -1179
  105. data/test/test-parser-yaml.rb +0 -57
  106. data/test/test-parser-yaml.yaml +0 -1749
  107. data/test/test-rule.rb +0 -26
  108. data/test/test-rule.yaml +0 -317
  109. data/test/test-users-guide.rb +0 -75
  110. data/test/test-util.rb +0 -125
  111. data/test/test-validator.rb +0 -95
  112. data/test/test-validator.yaml +0 -986
  113. data/test/test-yaml-parser.rb +0 -47
  114. data/test/test-yaml-parser.yaml +0 -1226
  115. data/test/test.rb +0 -61
@@ -1,32 +0,0 @@
1
- $ javac -classpath '.:kwalify.jar' *.java
2
- $ java -classpath '.:kwalify.jar' ExampleAddressBook
3
- group name: family
4
- group desc: my family
5
-
6
- group name: friend
7
- group desc: my friends
8
-
9
- group name: business
10
- group desc: those who works together
11
-
12
- person name: Sumire
13
- person group: family
14
- person email: null
15
- person phone: null
16
- person blood: A
17
- person birth: Tue Feb 01 00:00:00 JST 2000
18
-
19
- person name: Shiina
20
- person group: friend
21
- person email: shiina@mail.org
22
- person phone: null
23
- person blood: null
24
- person birth: Wed Feb 01 00:00:00 JST 1995
25
-
26
- person name: Sakura
27
- person group: business
28
- person email: cherry@mail.net
29
- person phone: 012-345-6789
30
- person blood: null
31
- person birth: null
32
-
@@ -1,31 +0,0 @@
1
- $ ruby example_address_book.rb
2
- [#<Group:0xddf24 @desc="my family", @name="family">,
3
- #<Group:0xddf10 @desc="my friends", @name="friend">,
4
- #<Group:0xdde84 @desc="those who works together", @name="business">]
5
- [#<Person:0xdefdc
6
- @birth=#<Date: 4903089/2,0,2299161>,
7
- @blood="A",
8
- @deleted=false,
9
- @desc=nil,
10
- @email=nil,
11
- @group="family",
12
- @name="Sumire",
13
- @phone=nil>,
14
- #<Person:0xdee9c
15
- @birth=#<Date: 4899437/2,0,2299161>,
16
- @blood=nil,
17
- @deleted=false,
18
- @desc=nil,
19
- @email="shiina@mail.org",
20
- @group="friend",
21
- @name="Shiina",
22
- @phone=nil>,
23
- #<Person:0xde8e8
24
- @birth=nil,
25
- @blood=nil,
26
- @deleted=false,
27
- @desc=nil,
28
- @email="cherry@mail.net",
29
- @group="business",
30
- @name="Sakura",
31
- @phone="012-345-6789">]
@@ -1,4 +0,0 @@
1
- $ kwalify -a genclass-java -tf address_book.schema.yaml
2
- generating ./AddressBook.java...done.
3
- generating ./Group.java...done.
4
- generating ./Person.java...done.
@@ -1,28 +0,0 @@
1
- require 'kwalify'
2
- #require 'yaml'
3
-
4
- ## load schema data
5
- schema = Kwalify::Yaml.load_file('schema.yaml')
6
- ## or
7
- #schema = YAML.load_file('schema.yaml')
8
-
9
- ## create validator
10
- validator = Kwalify::Validator.new(schema)
11
-
12
- ## create parser with validator
13
- ## (if validator is ommitted, no validation executed.)
14
- parser = Kwalify:::Yaml::Parser.new(validator)
15
-
16
- ## parse document with validation
17
- filename = 'document.yaml'
18
- document = parser.parse_file(filename)
19
- ## or
20
- #document = parser.parse(File.read(filename), filename)
21
-
22
- ## show errors if exist
23
- errors = parser.errors()
24
- if errors && !errors.empty?
25
- for e in errors
26
- puts "#{e.linenum}:#{e.column} [#{e.path}] #{e.message}"
27
- end
28
- end
@@ -1,25 +0,0 @@
1
- require 'kwalify'
2
- #require 'yaml'
3
-
4
- ## load schema data
5
- schema = Kwalify::Yaml.load_file('schema.yaml')
6
- ## or
7
- #schema = YAML.load_file('schema.yaml')
8
-
9
- ## create validator
10
- validator = Kwalify::Validator.new(schema)
11
-
12
- ## load document
13
- document = Kwalify::Yaml.load_file('document.yaml')
14
- ## or
15
- #document = YAML.load_file('document.yaml')
16
-
17
- ## validate
18
- errors = validator.validate(document)
19
-
20
- ## show errors
21
- if errors && !errors.empty?
22
- for e in errors
23
- puts "[#{e.path}] #{e.message}"
24
- end
25
- end
@@ -1,6 +0,0 @@
1
- require 'kwalify'
2
- parser = Kwalify::Yaml::Parser.new
3
- parser.preceding_alias = true # enable preceding alias
4
- ydoc = parser.parse_file('howto3.yaml')
5
- require 'pp'
6
- pp ydoc
@@ -1,5 +0,0 @@
1
- $ ruby howto3.rb
2
- [{"name"=>"Foo",
3
- "parent"=>{"name"=>"Bar", "parent"=>{"name"=>"Baz", "parent"=>nil}}},
4
- {"name"=>"Bar", "parent"=>{"name"=>"Baz", "parent"=>nil}},
5
- {"name"=>"Baz", "parent"=>nil}]
@@ -1,8 +0,0 @@
1
- - name: Foo
2
- parent: *bar # preceding alias
3
- - &bar
4
- name: Bar
5
- parent: *baz # preceding alias
6
- - &baz
7
- name: Baz
8
- parent: null
@@ -1,111 +0,0 @@
1
- $ ruby loadbabel.rb
2
- {"teams"=>
3
- [#<Babel::Team:0x53e0f8
4
- @chief=
5
- #<Babel::Member:0x53d5e0
6
- @desc="Scientist",
7
- @name="Kohichi Minamoto",
8
- @team=#<Babel::Team:0x53e0f8 ...>>,
9
- @desc="Level 7 ESPers",
10
- @members=
11
- [#<Babel::Member:0x53d018
12
- @desc="Psychokino",
13
- @name="Kaoru Akashi",
14
- @team=#<Babel::Team:0x53e0f8 ...>>,
15
- #<Babel::Member:0x53ca50
16
- @desc="Teleporter",
17
- @name="Aoi Nogami",
18
- @team=#<Babel::Team:0x53e0f8 ...>>,
19
- #<Babel::Member:0x53c488
20
- @desc="Psycometrer",
21
- @name="Shiho Sannomiya",
22
- @team=#<Babel::Team:0x53e0f8 ...>>],
23
- @name="The Children">],
24
- "members"=>
25
- [#<Babel::Member:0x53d5e0
26
- @desc="Scientist",
27
- @name="Kohichi Minamoto",
28
- @team=
29
- #<Babel::Team:0x53e0f8
30
- @chief=#<Babel::Member:0x53d5e0 ...>,
31
- @desc="Level 7 ESPers",
32
- @members=
33
- [#<Babel::Member:0x53d018
34
- @desc="Psychokino",
35
- @name="Kaoru Akashi",
36
- @team=#<Babel::Team:0x53e0f8 ...>>,
37
- #<Babel::Member:0x53ca50
38
- @desc="Teleporter",
39
- @name="Aoi Nogami",
40
- @team=#<Babel::Team:0x53e0f8 ...>>,
41
- #<Babel::Member:0x53c488
42
- @desc="Psycometrer",
43
- @name="Shiho Sannomiya",
44
- @team=#<Babel::Team:0x53e0f8 ...>>],
45
- @name="The Children">>,
46
- #<Babel::Member:0x53d018
47
- @desc="Psychokino",
48
- @name="Kaoru Akashi",
49
- @team=
50
- #<Babel::Team:0x53e0f8
51
- @chief=
52
- #<Babel::Member:0x53d5e0
53
- @desc="Scientist",
54
- @name="Kohichi Minamoto",
55
- @team=#<Babel::Team:0x53e0f8 ...>>,
56
- @desc="Level 7 ESPers",
57
- @members=
58
- [#<Babel::Member:0x53d018 ...>,
59
- #<Babel::Member:0x53ca50
60
- @desc="Teleporter",
61
- @name="Aoi Nogami",
62
- @team=#<Babel::Team:0x53e0f8 ...>>,
63
- #<Babel::Member:0x53c488
64
- @desc="Psycometrer",
65
- @name="Shiho Sannomiya",
66
- @team=#<Babel::Team:0x53e0f8 ...>>],
67
- @name="The Children">>,
68
- #<Babel::Member:0x53ca50
69
- @desc="Teleporter",
70
- @name="Aoi Nogami",
71
- @team=
72
- #<Babel::Team:0x53e0f8
73
- @chief=
74
- #<Babel::Member:0x53d5e0
75
- @desc="Scientist",
76
- @name="Kohichi Minamoto",
77
- @team=#<Babel::Team:0x53e0f8 ...>>,
78
- @desc="Level 7 ESPers",
79
- @members=
80
- [#<Babel::Member:0x53d018
81
- @desc="Psychokino",
82
- @name="Kaoru Akashi",
83
- @team=#<Babel::Team:0x53e0f8 ...>>,
84
- #<Babel::Member:0x53ca50 ...>,
85
- #<Babel::Member:0x53c488
86
- @desc="Psycometrer",
87
- @name="Shiho Sannomiya",
88
- @team=#<Babel::Team:0x53e0f8 ...>>],
89
- @name="The Children">>,
90
- #<Babel::Member:0x53c488
91
- @desc="Psycometrer",
92
- @name="Shiho Sannomiya",
93
- @team=
94
- #<Babel::Team:0x53e0f8
95
- @chief=
96
- #<Babel::Member:0x53d5e0
97
- @desc="Scientist",
98
- @name="Kohichi Minamoto",
99
- @team=#<Babel::Team:0x53e0f8 ...>>,
100
- @desc="Level 7 ESPers",
101
- @members=
102
- [#<Babel::Member:0x53d018
103
- @desc="Psychokino",
104
- @name="Kaoru Akashi",
105
- @team=#<Babel::Team:0x53e0f8 ...>>,
106
- #<Babel::Member:0x53ca50
107
- @desc="Teleporter",
108
- @name="Aoi Nogami",
109
- @team=#<Babel::Team:0x53e0f8 ...>>,
110
- #<Babel::Member:0x53c488 ...>],
111
- @name="The Children">>]}
@@ -1,3 +0,0 @@
1
- $ kwalify -lf schema01.yaml document01b.yaml
2
- document01b.yaml#0: INVALID
3
- - (line 2) [/1] '123': not a string.
@@ -1,5 +0,0 @@
1
- $ kwalify -lf schema02.yaml document02b.yaml
2
- document02b.yaml#0: INVALID
3
- - (line 2) [/email] 'foo(at)mail.com': not matched to pattern /@/.
4
- - (line 3) [/age] 'twenty': not a integer.
5
- - (line 4) [/birth] 'Jun 01, 1985': not a date.
@@ -1,5 +0,0 @@
1
- $ kwalify -lf schema03.yaml document03b.yaml
2
- document03b.yaml#0: INVALID
3
- - (line 3) [/1] key 'name:' is required.
4
- - (line 3) [/1/naem] key 'naem:' is undefined.
5
- - (line 6) [/2/mail] key 'mail:' is undefined.
@@ -1,4 +0,0 @@
1
- $ kwalify -lf schema04.yaml document04b.yaml
2
- document04b.yaml#0: INVALID
3
- - (line 4) [/employees/0/code] 'A101': not a integer.
4
- - (line 9) [/employees/1/mail] key 'mail:' is undefined.
@@ -1,11 +0,0 @@
1
- $ kwalify -lf schema05.yaml document05b.yaml
2
- document05b.yaml#0: INVALID
3
- - (line 2) [/0/email] 'foo(at)mail.com': not matched to pattern /@/.
4
- - (line 3) [/0/password] 'xxx123': too short (length 6 < min 8).
5
- - (line 4) [/0/age] 'twenty': not a integer.
6
- - (line 5) [/0/blood] 'a': invalid blood value.
7
- - (line 7) [/1] key 'name:' is required.
8
- - (line 7) [/1/given-name] key 'given-name:' is undefined.
9
- - (line 8) [/1/family-name] key 'family-name:' is undefined.
10
- - (line 10) [/1/age] '15': too small (< min 18).
11
- - (line 12) [/1/birth] '1980/01/01': not a date.
@@ -1,4 +0,0 @@
1
- $ kwalify -lf schema06.yaml document06b.yaml
2
- document06b.yaml#0: INVALID
3
- - (line 7) [/0/groups/3] 'foo': is already used at '/0/groups/0'.
4
- - (line 13) [/2/name] 'bar': is already used at '/1/name'.
@@ -1,3 +0,0 @@
1
- $ ruby answers-validator.rb document07b.yaml
2
- *** INVALID!
3
- 4:3 [/answers/1] reason is required when answer is 'bad'.
@@ -1,3 +0,0 @@
1
- $ ruby validate08.rb document07b.yaml
2
- *** INVALID!
3
- - [/answers/1] : reason is required when answer is 'bad'.
@@ -1,8 +0,0 @@
1
- $ kwalify -lf schema12.json document12b.json
2
- document12b.json#0: INVALID
3
- - (line 1) [/] key 'name:' is required.
4
- - (line 2) [/mail] key 'mail:' is undefined.
5
- - (line 3) [/age] 'twenty': not a integer.
6
- - (line 4) [/gender] 'X': invalid gender value.
7
- - (line 5) [/favorite/0] '123': not a string.
8
- - (line 5) [/favorite/1] '456': not a string.
@@ -1,4 +0,0 @@
1
- $ kwalify -lf schema14.yaml document14b.yaml
2
- document14b.yaml#0: INVALID
3
- - (line 2) [/value2] '1.1': too large (> max 1).
4
- - (line 3) [/value3] '-2.0': too small (< min -1).
@@ -1,4 +0,0 @@
1
- $ kwalify -lf schema15.yaml document15b.yaml
2
- document15b.yaml#0: INVALID
3
- - (line 5) [/user] key 'email:' is required.
4
- - (line 5) [/user/name] 'toooooo-looooong-name': too long (length 21 > max 16).
@@ -1,27 +0,0 @@
1
- require 'kwalify'
2
- require 'models'
3
-
4
- ## load schema definition
5
- schema = Kwalify::Yaml.load_file('BABEL.schema.yaml',
6
- :untabify=>true,
7
- :preceding_alias=>true)
8
-
9
- ## add module name to 'class:'
10
- Kwalify::Util.traverse_schema(schema) do |rulehash|
11
- if rulehash['class']
12
- rulehash['class'] = 'Babel::' + rulehash['class']
13
- end
14
- end
15
-
16
- ## create validator
17
- validator = Kwalify::Validator.new(schema)
18
-
19
- ## parse with data-binding
20
- parser = Kwalify::Yaml::Parser.new(validator)
21
- parser.preceding_alias = true
22
- parser.data_binding = true
23
- ydoc = parser.parse_file('BABEL.data.yaml', :untabify=>true)
24
-
25
- ## show document
26
- require 'pp'
27
- pp ydoc
@@ -1,16 +0,0 @@
1
- ## class definition
2
- require 'kwalify/util/hashlike'
3
- class Config
4
- include Kwalify::Util::HashLike # defines [], []=, and keys?
5
- attr_accessor :host, :posrt, :user, :pass
6
- end
7
- ## create validator object
8
- require 'kwalify'
9
- schema = Kwalify::Yaml.load_file('config.schema.yaml')
10
- validator = Kwalify::Validator.new(schema)
11
- ## parse configuration file with data binding
12
- parser = Kwalify::Yaml::Parser.new(validator)
13
- parser.data_binding = true # enable data binding
14
- config = parser.parse_file('config.yaml')
15
- require 'pp'
16
- pp config
@@ -1,6 +0,0 @@
1
- $ ruby loadconfig.rb
2
- #<Config:
3
- @host="localhost",
4
- @pass="password1",
5
- @port=8080,
6
- @user="user1">
@@ -1,22 +0,0 @@
1
- require 'kwalify/util/hashlike'
2
-
3
- module Babel
4
-
5
- ##
6
- class Team
7
- include Kwalify::Util::HashLike
8
- attr_accessor :name # str
9
- attr_accessor :desc # str
10
- attr_accessor :chief # map
11
- attr_accessor :members # seq
12
- end
13
-
14
- ##
15
- class Member
16
- include Kwalify::Util::HashLike
17
- attr_accessor :name # str
18
- attr_accessor :desc # str
19
- attr_accessor :team # map
20
- end
21
-
22
- end
@@ -1,6 +0,0 @@
1
- $ kwalify -ha genclass-ruby
2
- --module=name : module name in which class defined
3
- --parent=name : parent class name
4
- --include=name : module name which all classes include
5
- --initialize=false : not print initialize() method
6
- --hashlike : include Kwalify::Util::HashLike module
@@ -1,7 +0,0 @@
1
- $ kwalify -ha genclass-java
2
- --package=name : package name
3
- --extends=name : class name to extend
4
- --implements=name,... : interface names to implement
5
- --dir=path : directory to locate output file
6
- --basedir=path : base directory to locate output file
7
- --constructor=false : not print initialize() method
@@ -1,3 +0,0 @@
1
- type: seq
2
- sequence:
3
- - type: str
@@ -1,12 +0,0 @@
1
- type: map
2
- mapping:
3
- "name":
4
- type: str
5
- required: yes
6
- "email":
7
- type: str
8
- pattern: /@/
9
- "age":
10
- type: int
11
- "birth":
12
- type: date
@@ -1,9 +0,0 @@
1
- type: seq
2
- sequence:
3
- - type: map
4
- mapping:
5
- "name":
6
- type: str
7
- required: true
8
- "email":
9
- type: str
@@ -1,20 +0,0 @@
1
- type: map
2
- mapping:
3
- "company":
4
- type: str
5
- required: yes
6
- "email":
7
- type: str
8
- "employees":
9
- type: seq
10
- sequence:
11
- - type: map
12
- mapping:
13
- "code":
14
- type: int
15
- required: yes
16
- "name":
17
- type: str
18
- required: yes
19
- "email":
20
- type: str
@@ -1,29 +0,0 @@
1
- type: seq
2
- sequence:
3
- -
4
- type: map
5
- mapping:
6
- "name":
7
- type: str
8
- required: yes
9
- "email":
10
- type: str
11
- required: yes
12
- pattern: /@/
13
- "password":
14
- type: text
15
- length: { max: 16, min: 8 }
16
- "age":
17
- type: int
18
- range: { max: 30, min: 18 }
19
- # or assert: 18 <= val && val <= 30
20
- "blood":
21
- type: str
22
- enum: [A, B, O, AB]
23
- "birth":
24
- type: date
25
- "memo":
26
- type: any
27
- "deleted":
28
- type: bool
29
- default: false
@@ -1,11 +0,0 @@
1
- type: seq
2
- sequence:
3
- - type: map
4
- required: yes
5
- mapping:
6
- "name": { type: str, required: yes, unique: yes }
7
- "email": { type: str }
8
- "groups":
9
- type: seq
10
- sequence:
11
- - { type: str, unique: yes }
@@ -1,12 +0,0 @@
1
- { "type": "map",
2
- "required": true,
3
- "mapping": {
4
- "name": { "type": "str", "required": true },
5
- "email": { "type": "str" },
6
- "age": { "type": "int" },
7
- "gender": { "type": "str", "enum": ["M", "F"] },
8
- "favorite": { "type": "seq",
9
- "sequence": [ { "type": "str" } ]
10
- }
11
- }
12
- }
@@ -1,13 +0,0 @@
1
- type: seq
2
- sequence:
3
- - &employee
4
- type: map
5
- mapping:
6
- "given-name": &name
7
- type: str
8
- required: yes
9
- "family-name": *name
10
- "post":
11
- type: str
12
- enum: [exective, manager, clerk]
13
- "supervisor": *employee
@@ -1,5 +0,0 @@
1
- type: map
2
- mapping:
3
- =: # default rule
4
- type: number
5
- range: { max: 1, min: -1 }
@@ -1,21 +0,0 @@
1
- type: map
2
- mapping:
3
- "group":
4
- type: map
5
- mapping:
6
- "name": &name
7
- type: str
8
- required: yes
9
- "email": &email
10
- type: str
11
- pattern: /@/
12
- required: no
13
- "user":
14
- type: map
15
- mapping:
16
- "name":
17
- <<: *name # merge
18
- length: { max: 16 } # add
19
- "email":
20
- <<: *email # merge
21
- required: yes # override
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema01.yaml document01a.yaml
2
- document01a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema02.yaml document02a.yaml
2
- document02a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema03.yaml document03a.yaml
2
- document03a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema04.yaml document04a.yaml
2
- document04a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema05.yaml document05a.yaml
2
- document05a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema06.yaml document06a.yaml
2
- document06a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ ruby answers-validator.rb document07a.yaml
2
- Valid.
@@ -1,2 +0,0 @@
1
- $ ruby validate08.rb document07a.yaml
2
- Valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema12.json document12a.json
2
- document12a.json#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema13.yaml document13a.yaml
2
- document13a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema14.yaml document14a.yaml
2
- document14a.yaml#0: valid.
@@ -1,2 +0,0 @@
1
- $ kwalify -lf schema15.yaml document15a.yaml
2
- document15a.yaml#0: valid.