Basic Syntax

Here is the basic syntax of Portex:

---
type: <type>
<type-param 1>: <value 1>
<type-param 2>: <value 2>
...: ...
...: ...

Portex provides the basic key type. Its value means the type of data and presented by a JSON string. The bulitin supported types can be found in Primitive Types and Complex Types.

The most important feature of Portex is that the type is configurable, different types has different parameters.

For example, the enum type has parameters values to indicate the possible values of the enum.

So an enum of "dog" and "cat" can be defined:

---
type: enum
values: ["dog", "cat"]

Besides the builtin types, the customized types can also be configurable, check Template Type for more details.

Nullable Type

Portex provides a common parameter nullable for all types to indicate whether the value can be null.

name

type

required

default

description

nullable

JSON boolean

False

False

Default to False, which means all types are not nullable by default.
Setting to True allows the stored value to be null.

Examples:

Nullable 32-bits signed integer:

---
type: int32
nullable: true