Skip to content

Schema properties

String

Stores a JSON string.

Example:

aeria-properties
name str

@mask

A mask or array of masks. Example:

aeria-properties
phone str @mask(["(##) #####-####"])

@minLength

The minimum accepted length.

aeria-properties
pin str @minLength(8)

@maxLength

The maximum accepted length.

aeria-properties
slug str @maxLength(16)

@placeholder

A placeholder to be shown when no value is present.

aeria-properties
code str @placeholder("Example: 123456")

Number and Integer

Stores a JSON number.

Example:

aeria-properties
age int // integer numbers only
weight num // floating point numbers

@minimum

Minimum accepted value.

aeria-properties
age num @minimum(10)

@maximum

Maximum accepted value.

aeria-properties
percentage num @maximum(100)

@exclusiveMinimum

Minimum accepted value (exclusive).

aeria-properties
age num @exclusiveMinimum(10)

@exclusiveMaximum

Maximum accepted value (exclusive).

aeria-properties
percentage num @exlusiveMaximum(100)

Boolean

Stores a JSON boolean.

Example:

aeria-properties
is_active bool

Date

Stores an ISO date string.

Example:

aeria-properties
member_since date

Datetime

Stores an ISO date string, exactly like date. The difference is that time information will also be shown on frontends.

Example:

aeria-properties
opened_at datetime

Object

Represents a nested object.

Example:

aeria-properties
details {
  properties {
    weight num
  }
}

Reference

Represents a link to a document of another or the same collection. In the database, a ObjectId BSON object is stored.

Example:

aeria-properties
created_by User

@inline

Marks the reference as being inline. This means:

  • the referenced document will be deleted when the parent document is deleted
  • all nested references will be automatically populated

Example use case: imagine a Post collection which has an array of Comment references that can be placed by users. There is no reason why a Comment should exist without the post it is vinculated with, so it should be marked as inline so the proper cleanup would be done when the post is removed.

File references are always inline.

Example:

aeria-properties
comments []Comment @inline

@purge

Indicates the referenced document should be removed when the parent document is removed.

aeria-properties
comments []Comment @purge

@indexes

Used to set which foreign properties should be used as indexes. Setting this property and running aeria -m will result in collection indexes being created in the database.

Example:

aeria-properties
customers []Customer @indexes([
  "name",
  "phone",
  "document",
])

Array

Properties prefixed with an [] are turned into an array. For example, if you wish to have an array of strings, write []str.

Example:

aeria-properties
comments []{
  properties {
    text str
    liked_by []User
  }
}

A special syntax is used to add array constraints.

You may specify a range of minimum and maximum allowed array elements like so:

  • [1..3]: minimum 1 element, maximum 3 elements
  • [1..]: minimum 1 element, no maximum limit
  • [@uniqueItems]: elements can not repeat within the array
  • [1.. @uniqueItems]: minimum 1 element, no maximum limit, elements can not repeat within the array

Released under the MIT License.