* name, required - the name of the resource-type. It becomes the name of the chip representing the resource type, as well. It has to be unique amongst all other resource-types.
* fields, required - an array of field descriptions. You can read about field description syntax below.
* access_strategy, optional. A hashmap or string compatible with access strategy description syntax, described below. Defaults to public.
*/
varResourceType=function(declaration){
if(typeofdeclaration!="object"){
thrownewSealious.Errors.DeveloperError("Tried to create a resource-type without a declaration");
@param {object} field_declaration - consistnent with field declaration syntax
{
name: String,
type: FieldTypeName,
human_readable_name?: String,
params?: Object
}
* name, required - a string representing the machine-readable name for the field. Should be short. No spaces allowed. All lower-case letters, the _ and - symbols are allowed.
* human_readable_name, optional - a string representing a human-readable version of the field’s name. No restrictions on what is and what is not allowed here. When not specified, the value of ‘name’ attribute is used instead.
* type, required - a string representing a resource-type name that is already registred in your Sealious application.
* params, optional - a hashmap of parameters that will be passed to the field-type. These parameters are also a part of the field’s signature. Defaults to {}.
Checks if all values from given array are represented as fields resource type
@params {array} values - array of names of fields, which resource type should have
@returns {hashmap} validation_errors - hashmap of errors, if there was an unknown field there would be entry under key "missing_field_name" with value "unknown_field"
* @param {Boolean} with validator - - whether to include validator function in field description.
* Warning! If set to true, the output is not serializable in JSON.
* @returns {} resource type signature
*/
this.get_specification=function(with_validators){
//with_validators:boolean - whether to include validator functions in field descriptions. Warning! If set to true, the output is not serializable in JSON.