Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Last active June 7, 2016 11:14
Show Gist options
  • Save frsyuki/b253c9ceb80bb3a4926b to your computer and use it in GitHub Desktop.
Save frsyuki/b253c9ceb80bb3a4926b to your computer and use it in GitHub Desktop.
##
## Syntax
##
# Define a type:
#
# <MessageName>:
# <fieldIndex>: [<fieldName>, <type>, <options...>]
# ...
#
# Typedef (type alias):
#
# <MessageName>: [<type>, <options>...]
#
##
## Types
##
#
# double double-precision floating point number
# int 32-bit signed int
# int64 64-bit signed int
# uint64 64-bit unsigned int
# bool true or false
# string UTF-8 string
# bytes byte array
# timestamp timestamp (no timezone)
# array: [E] array of E
# map: [K, V] map where key type is K and value type is V
# enum: {0: E1, 1: E2, ...} enum
#
##
## Type options
##
#
# Standard options:
#
# nullable this type is nullable
# default: VALUE use this value if value is unavailable or null
# in: [V1, V2, ...] this value must be one of the values
# min: INTEGER this integer (or length of this string/bytes) must be same or larger than INTEGER
# max: INTEGER this integer (or length of this string/bytes) must be same or smaller than INTEGER
# regexp: REGEXP this string or bytes must match with REGEXP
# typename this type may be extended (type inheritance). this field is used to determine subtype during deserialization
#
# In addition to above options, implementation-specific options might be available.
# For example, MessageSchema for Java may support:
#
# mutable this array or map uses mutable classes (ArrayList or HashMap)
# ordered this map uses LinkedHashMap instead of ImmutableHashMap
#
##
## Examples
##
Repository:
0: [name, string]
1: [createdAt, timestamp]
2: [revisions, array: [Revision]]
Revision:
0: [name, string, min: 1, max: 255]
1: [type, RevisionType]
2: [site, int, default: 0]
3: [parentName, string, nullable]
4: [createdAt, timestamp]
5: [md5, bytes, nullable]
6: [size, int64, min: 0]
StoredRevision:
extend: [Revision]
7: [id, int]
RevisionType:
- enum:
0: DB
1: S3
2: NONE
Node:
0: [type, string, typename]
1: [id, int]
2: [parentId, int, nullable]
ScanNode:
extend: [Node, typename: "scan"]
3: [table, string]
4: [format, string]
FilterNode:
extend: [Node, typename: "filter"]
3: [expression, string]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment