Versions Compared

Key

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

...

  1. Loads the arrow module
  2. Calls the module's createModel('name', schema) method method (or another Model method), passing in the name of the model as the first parameter and an object defining the model schema as the second parameter
  3. Exports the defined endpoint using the module.exports variable

...

NameRequiredDescription
fieldstrueAn object that represents the model’s schema defined as key-value pairs. The key is the name of the field and the value is the fields object. See the next table for details.
connectortrueConnector to which the model is bound (string). Each model can only have one connector. Connectors are responsible for reading and writing data from/to their data source.
documentedfalseSince Release 5.0.0. Determines whether to generate API documentation (true) or not (false). The default value is true.
metadatafalseUsed to provide connector specific configuration (for example, mapping the model to a specific database table for the MySQL connector or defining the join properties).
autogenfalseUsed to determine whether to generate API endpoints directly from the model. The default value is true. If the endpoint is auto-generated, you do not need to create an API endpoint definition.
actionsfalseAn array of data operations supported by the model. The valid values are: create, read, update, and delete. By default, all are supported by the model.
pluralfalseA string used as the property name when your API endpoint returns an array. By default, the plural value is the plural of the model name. For example, if your model is named car, the default plural would be cars. Note: this value can be set on an API or a model.
singularfalseA string used as the property name when your API endpoint returns a single record. By default, the singular value is the name of the model. Note: this value can be set on an API or a model.
beforefalseOne or more blocks to be executed before the request. Blocks are referenced by their name property. If you want to execute multiple blocks, you should specify them as an array of block names. If multiple blocks are specified, they are executed in the order specified.
afterfalseOne or more blocks to be executed after the request. Blocks are referenced by their name property. If you want to execute multiple blocks, you should specify them as an array of block names. If multiple blocks are specified, they are executed in the order specified.

Field definition

The The propertyfields property (mentioned above) supports a number of sub-properties as well. The table below outlines these properties.

...