Skip to content

Commit

Permalink
Follow Sah::Schemas convention
Browse files Browse the repository at this point in the history
  • Loading branch information
perlancar committed Jun 11, 2016
1 parent 308c444 commit 15994bf
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 151 deletions.
151 changes: 0 additions & 151 deletions lib/Sah/Schema/Sah.pm

This file was deleted.

17 changes: 17 additions & 0 deletions lib/Sah/Schema/sah/array_schema.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package Sah::Schema::sah::array_schema;

# DATE
# VERSION

our $schema = ['array' => {
min_len => 1,
max_len => 3,
elems => [
['sah::type_name', {req=>1}, {}],
['sah::clause_set', {}, {}],
['sah::extras', {}, {}],
],
}, {}];

1;
# ABSTRACT: Sah schema (array form)
27 changes: 27 additions & 0 deletions lib/Sah/Schema/sah/clause_set.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package Sah::Schema::sah::clause_set;

# DATE
# VERSION

our $schema = [defhash => {
_prop => {
# from defhash
v => {},
defhash_v => {},
name => {},
summary => {},
description => {},
tags => {},
default_lang => {},
x => {},

# incomplete
clause => {
},
clset => {
},
},
}];

1;
# ABSTRACT: Sah clause set
10 changes: 10 additions & 0 deletions lib/Sah/Schema/sah/extras.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package Sah::Schema::sah::extras;

# DATE
# VERSION

our $schema = ['defhash' => {
}, {}];

1;
# ABSTRACT: Sah extras (third element in array schema)
14 changes: 14 additions & 0 deletions lib/Sah/Schema/sah/schema.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package Sah::Schema::sah::schema;

# DATE
# VERSION

our $schema = [any => {
of => [
'sah::str_schema',
'sah::array_schema',
],
}, {}];

1;
# ABSTRACT: Sah schema
15 changes: 15 additions & 0 deletions lib/Sah/Schema/sah/str_schema.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package Sah::Schema::sah::str_schema;

# DATE
# VERSION

use 5.010;
use strict;
use warnings;

our $schema = ['str' => {
match => '\A[A-Za-z][A-Za-z0-9_]*(::[A-Za-z][A-Za-z0-9_]*)*\*?\z',
}, {}];

1;
# ABSTRACT: Sah schema (string form)
11 changes: 11 additions & 0 deletions lib/Sah/Schema/sah/type_name.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package Sah::Schema::sah::type_name;

# DATE
# VERSION

our $schema = [str => {
match => '\A[A-Za-z][A-Za-z0-9_]*(::[A-Za-z][A-Za-z0-9_]*)*\z',
}, {}];

1;
# ABSTRACT: Type name
7 changes: 7 additions & 0 deletions lib/Sah/Schemas/Sah.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package Sah::Schemas::Sah;

# DATE
# VERSION

1;
# ABSTRACT: Sah schemas for Sah

0 comments on commit 15994bf

Please sign in to comment.