Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


typetrueThe field primitive type plus others (e.g., ‘string’, 'number', 'boolean', 'object', 'array', 'date'). Type can be any valid JavaScript primitive type. Type can be specified as a string (e.g., ‘string’) or by the type class (e.g., String).
requiredfalseSpecifies whether the field is required. The default value is false.
validatorfalseA function or regular expression that validates the value of the field. The function is passed the data to validate and should return either null or undefined if the validation succeeds. Any other return value means the validation failed, and the return value will be used in the exception message. If a regular expression is used, it should evaluate to either true or false.
namefalseUsed if the model field name is different than the field name in the connector’s model or the underlying data source for the field name. For example, if my model field is first_name and the column in a MySQL database is fname, the value of the name property should be 'fname'.
defaultfalseThe default value for the field.
descriptionfalseThe description of the field (used for API documentation).
readonlyfalseEither true or false. If true the field will be read-only and any attempt to write the field value will fail.
maxlengthfalseThe max length of the field (specified as an integer)
getfalseA function used to set the value of a property that will be sent to the client. This property is useful if you want to define a custom field where the value is derived.
setfalseA function used to set the value of a property that will be sent to the connector.
customfalseThis property should be specified and set to true if you are defining a custom field. A custom field is one that does not exist in the underlying data source for the connector you specified.
modelfalseModel name of the field property. This is either the logical name of a custom model or a connector model name in the form connector/model_name (e.g., appc.mysql/employee)

Model schema example

The example below creates the car model with the specified schema.  The car models will be stored in Mobile Backend Services as CustomObjects.  Since the autogen property was not set to false, API Builder automatically generates the pre-define endpoints for the client to access the car models using the <SEVER_ADDRESS>/ api/car endpoints.