Created
June 14, 2012 14:57
-
-
Save Evgenus/2930848 to your computer and use it in GitHub Desktop.
YAML Schema Draft #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Field: !Mapping | |
fields: | |
type: # <--- that is name | |
type: | |
- string | |
- TypesList | |
optional: False # some explicid definition | |
optional: | |
type: boolean | |
optional: True | |
default: False | |
default: | |
type: object | |
optional: True | |
# do not define default for default | |
IntField: !Mapping | |
extend: Field | |
fields: | |
type: | |
# type is not defined because it was inherited | |
optional: True | |
default: int | |
ge: # >= | |
type: int | |
optional: True | |
gt: # > | |
type: int | |
optional: True | |
eq: # == | |
type: int | |
optional: True | |
ne: # != | |
type: int | |
optional: True | |
le: # < | |
type: int | |
optional: True | |
lt: # <= | |
type: int | |
optional: True | |
StringFields: !Mapping | |
extend: Field | |
fields: | |
type: | |
optional: True | |
default: str | |
min_length: !IntField | |
optional: True | |
ge: 0 | |
default: 0 | |
max_length: !IntField | |
optional: True | |
ge: 0 | |
regex: !StringFields | |
optional: True | |
regex: "^((?:(?:[^?+*{}()[\]\\|]+|\\.|\[(?:\^?\\.|\^[^\\]|[^\\^])(?:[^\]\\]+|\\.)*\]|\((?:\?[:=!]|\?<[=!]|\?>)?(?1)??\)|\(\?(?:R|[+-]?\d+)\))(?:(?:[?+*]|\{\d+(?:,\d*)?\})[?+]?)?|\|)*)$" | |
Idetifier: !StringFields | |
min_length: 1 | |
regex: "^[^\d\W]\w*$" | |
TypesList: !List | |
min_length: 1 | |
item_type: string | |
Rule: !Mapping | |
fields: | |
extend: | |
type: | |
- string | |
- TypesList | |
optional: True | |
List: !Mapping | |
extend: Rule | |
fields: | |
min_length: !IntField | |
optional: True | |
ge: 0 | |
default: 0 | |
max_length: !IntField | |
optional: True | |
ge: 0 | |
item_type: !IntField | |
type: | |
- string | |
- TypesList | |
optional: False | |
PairPattern: !Mapping | |
fields: | |
key: | |
type: | |
- string | |
- TypesList | |
optional: True | |
value: | |
type: | |
- string | |
- TypesList | |
optional: True | |
FieldsMap: !Mapping | |
patterns: | |
- | |
key: Identifier | |
value: Field | |
Mapping: !Mapping | |
extend: Rule | |
fields: | |
fields: | |
type: FieldsMap | |
optional: True | |
patterns: !List | |
item_type: PairPattern | |
min_length: 1 | |
optional: True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment