Prop options

All props share some common properties that can help you change the default behavior.

type

Defines prop type, valid values are null, object, array, string, number, integer, date, boolean, id, binary.

$comment

Intended for notes to schema maintainers, as opposed to "description" which is suitable for display to end users.

default

The default keyword specifies a default value for an property. Additional you can overwrite default with advancedDefault keyword. With advancedDefault you can set default from URL query component value or from custom JavaScript code.

Bottom example first tries to set default from http://localhost?email= URL encoded value if not found it will fallback to default keyword.

"email": {
  "type": "string",
  "format": "email",
  "default": "info@example.com",
  "advancedDefault": {
    "query": "email"
  }
}

default interface

Value must be same type as property type.

advancedDefault

advancedDefault interface

Parameters

Type

Description

query

string

$eval

string

Custom JavaScript code. Code must return value.

Example: return 123;

const

Force value of prop. Can't be changed.

required

If required: true prop value is required.

virtual

Props that have virtual: true will be ignored when calling getValue({ virtual: false}).

nullable

readonly

If readonly: true input field is disabled.

writeonly

Depends on your API implementation.

searchable

searchable?: {

    title?: string;

    /**
     * If enabled it will be displayed to user under More button, when using advanced search.
     */
    byUser?: {

      /**
       * Only show search field if specific mode is present.
       */
      $mode?: string;
      enabled?: true;
    }
  }

Last updated

Was this helpful?