Skip to content

Format of file, containing schema of custom object (sad::db::custom::Schema, supported from 1.3 )

Dmitry Mamontov edited this page Sep 10, 2015 · 3 revisions

Description

This type of files used to contain resources and definition for custom objects, with non-hardcoded properties. Physically, it's JSON file with array of objects, each of one is custom schema definition.

Custom schema

Custom schema definition must have following properties:

  • "name" - a name of schema resource
  • "resource" - a link to font or texture atlas entry, which will define, how object, created with schema will look.
  • "schema" - an object, which contains a properties, whose names are defined as property name, and values are objects. Those object must have "type" property, which will define the type, that property have and "value" property, which will define a default value for property. Also, they could have "default" property, which should be used for marking those properties, which could be absent in JSON, when object will be loaded. This property should contain default value, that will be substituted in those cases. A "default" property is supported from release 1.5.2

Example

A simple example could be found in $SADDY$/bin/tests/db/label.json

[
{
 "name" : "myobject",
 "resource": "objects",
 "schema" : {
	"prop1" : {"type" : "int", "value" : 0 },
	"prop2" : {"type" : "int", "value" : 0 }
 }
}
]