summaryrefslogtreecommitdiff
path: root/examples/kwalify-2.pp
blob: 3f4ec33dad2bd9d6cddb1c9b29b39f0ccbbb3074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$schema = {
  'type' => 'map',
  'mapping' => {
    'name' => {
      'type' => 'str',
      'required' => true,
    },
    'email' => {
      'type' => 'str',
      'pattern' => '/@/',
    },
    'age' => {
      'type' => 'str',
      'pattern' => '/^\d+$/',
    },
  }
}
$document = {
  'name' => 'foo',
  'email' => 'foo@mail.com',
  'age' => 20,
}

kwalify($schema, $document)