JSON Specification
In these docs we make extensive use of JSON schemas to define the API interface. We use the following types:
String= text i.e.”value”Integer= Integer numberFloat= Floating Point numberBool= Boolean i.e.trueList<T>= list of typeTObject<T>= JSON object namedT, which is defined elsewhereOptional<T>=Tmay or may not be presentNullable<T>= can beTornullEnum<T>= an enumeration namedTUuid= A valid UUID. See the spec (this will be aStringin the JSON)
An example might be
JSON
{
"a_string": String,
"a_number": Float,
"a_bool": Bool,
"a_list": List<Integer>,
"an_object": Object<SomeObject>,
"an_option": Option<String>,
"nullable": Null<String>
}
Where SomeObject is
JSON
{
"key": String
}
An instance of this object could be
JSON
{
"a_string": "Hello!",
"a_number": 654.3,
"a_bool": true,
"a_list": [12,11],
"an_object": {
"key": "I'm some text!"
},
"nullable": null
}
Enum<T> will appear as String, but Naurt makes a guaranteed that only certain
strings will ever appear in that field. For example, we might define Enum<Pet>
as
catdoggoldfish
This means that a JSON with this field
JSON
{
"pet": Enum<Pet>
}
an example would be
JSON
{
"pet": "cat" // or "dog" or "goldfish" but NEVER "shark"
}