Skip to content

Schema properties ​

Base attributes ​

  • @description(string) - assigns a description to the property for documentation and visualization purposes
  • @hint(string) - places a hint down below the property field in forms
  • @focus(boolean) - tells the frontend that the property field should be auto-focused on forms
  • @hidden(boolean) - informs the property should not be returned from the API
  • @icon(string) - specifies a icon to be associated with the property on the frontend
  • @readonly(boolean) - marks the property as being read-only
  • @translate(boolean) - informs the property value should be translated when i18n is available

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

Const ​

Stores a constant value.

Example:

aeria-properties
status const @value("active")

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

Enum ​

Stores an enumeration of constant values.

Example:

aeria-properties
status enum @values([
  "pending",
  "paid",
  "canceled",
])

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

@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",
])

@constraints ​

Constrain the reference to match requirements before being inserted.

Example:

aeria-properties
customer User @constraint(roles in "customer")

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.