Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

schema data

Konstantin Sobolev edited this page Jul 26, 2017 · 2 revisions

Schema data expressions

Data expressions define data instances used by some schema parts such as annotations or default parameter values. Values can be created for all supported type kinds. Errors and metadata are not supported.

Type specification

Although in most cases value type follows from the context, e.g. annotation or parameter type, sometimes it is needed to specify value type explicitly, for instance if actual parameter value is a sub-type of declared parameter type. To allow this any value can be prepended by a type specification <type reference>, followed by @ for primitives and null.

Examples:

MyType@null
Person < id: UserId@777 >

Null

Syntax: null, prepended by optional type specification.

String

Sequence of characters in double quotes. " character can be escaped using backslash. Can optionally be prepended by type specification.

Examples:

"\"Sugar Ray\" Leonard"
MyType@"a string"

Numbers

Integer and floating point numbers in scientific notation, can optionally be prepended by type specification. Presicion should not exceed corresponding data types.

Examples:

0
MyType@-1
2.99792e+08

Record

Syntax: <type>? { <fields> }, where <type>? is optional type specification and <fields> is a list of field values separated by optional commas. Field value is <field name> : <data expression>.

Examples:

{}
UserRecord{ firstName: "Alfred", lastName: "Hitchcock" }

Map

Syntax: <type>? ( <entries> ), where <type>? is optional type specification and <entries> is a list of map entries separated by optional commas. Map entry is <data expression> : <data expression>.

Examples:

RootsMap( 2: 1.41421, 1: 1, 0: 0, -1: null )

List

Syntax: <type>? [ <entries> ], where <type>? is optional type specification and <entries> is a list of data expressions separated by optional commas.

Examples:

[ 1914, 1939, null ]

Entity

Syntax: 〈type〉? < 〈entries〉 >, where 〈type〉? is optional type specification and 〈entries〉 is a list of tag values separated by optional commas. Tag value is <tag name> : <data expression>.

Examples:

User< id: 1, `record`: { firstName: "Alfred" } >

record has to be escaped because it's one of the schema keywords.

Clone this wiki locally