📋Project configuration

Each project created or edited through the CLI is configured using a JSON file which defines your project's configuration. This is a complete reference of the available properties.

Project object

Property nameTypeDescription

name

String

The name of your project. This can be changed later

models

Object { [name]: Model}

An object whose keys are the name of a model, and the value is a model object.

api

The configuration of your API.

Model object

Property nameTypeDescription

primary_key

String | String[]

The name of your primary key. This must match the name of one of your properties. To use a composite index, pass an array. Primary key must always be non-nullable.

properties

Object {

[name]: Property

}

An object whose keys are the name of a property, and the value is a property object.

Property object

Property nameTypeDescription

type

'string' | 'boolean' | 'number' | 'date' | 'timestamp' | 'array' | 'reference'

The type of your property. If it set to array, then items must be defined. If it set to reference, then reference must be defined.

nullable

Boolean

Indicates whether the property is nullable in the database or not. If not specified, the default value is true.

readonly

Boolean

A readonly property will never be able to be set by the client, on create or update operations.

unique

Boolean

Indicates that the associated value can only exist once in the database.

reference

String

A reference to an existing property. It must only be used if type is set to reference. The value must match the name of one your model (eg. Planet), or one of your model's property (eg. Planet/name)

items

Must only be used if type is set to array.

API object

Property nameTypeDescription

info

A description of your API.

paths

Object {

[path]: Path

}

An object whose keys are paths (eg. /planets/:id) and values are path objects.

Info object

Property nameTypeDescription

title

String

The name of your API

description

String

A short description of your API

version

String

A semver-compatible version (eg. 1.0.0)

Path object

Property nameTypeDescription

methods

Object {

[http_verb]: Method

}

An object whose keys are HTTP verbs such as get, post, put, patch and whose values are method objects.

parameters

An array of parameter objects.

paths

Object { [path]: Path }

An object whose keys are paths (eg. /planets/:id) and values are path objects. They will act as subpaths of the parent path.

Parameters defined at the path level apply to all its methods, but also its subpath methods. If you only wish to define a parameter for a single method, define the parameter at the method level.

Method object

Property nameTypeDescription

operationId

String

A unique identifier for your endpoint

description

String

A short description of what your endpoint does

parameters

An array of parameter objects.

body

A property describing the body of the HTTP request. It must only be used on POST, PUT or PATCH endpoints.

responses

Object {

[status_code]: Property

}

An object whose keys are HTTP status codes as strings, and whose values are property objects. Response objects must include a description

Parameter object

Property nameTypeDescription

name

String

The name of your parameter. The couple (name, in) must be unique.

description

String

A description of what your parameter does.

in

'path' | 'query'

Defines where to expect the parameter, either in path or query. If it set to path, then the path must include a URL parameter of the same name, using the format: /path/:param

required

Boolean

Makes the parameter mandatory. It can only be used for query parameters, as path parameters are always required.

Last updated