Data Types

The internet object schema defines six data types that include string, number, int, int32, int16, byte, email, url, datetime, date, time, bool, object, array or any.

The types string and number have subtypes. The email, url, datetime, date and time are subtypes of string. The int, int32, int16, byte are subtypes of number.

TypeDefs

Typedefs are a memberdef schema for the specified type. They define the constraints for the particular data type. The following example

type: { string, choices: [
    string, email, url, datetime, date, time,
    number, int, int32, int16, byte,
    object, array, bool
  ]
}
type      : {string, choices: [string, email, url, datetime, date, time]},
default?  : string,
choices?  : [string],
pattern?  : string,
maxLen?   : {int, min:0},
len?      : {int, min:0},
optional? : {bool, F},
null?     : {bool, F}

Some of the valid String MemberDef values are...

# The name is string and default value is ""
name: {string, ""}

# The website is of url type!
website: {url, optional:T} 

# The rgb's default is red, and choices are red, green, blue
rgb: {string, red, [red, green, blue]}

# The description is string that can have maximum length of 500 characters 
description: {string, maxLen:500} # 

As shown in the example above, Objects, Numbers, Arrays, Boolean, and Any have their respective TypeDef.

Last updated