processmaker-builder
Version:
The gulp task runner for ProcessMaker building
163 lines (91 loc) • 4.25 kB
Markdown
# and
Following attributes can be used with ``, they also apply for `` comment
that is added to model class properties.
Just replace
[type] $name ...
with
[type] ...
in the examples below
##
**Syntax:**
[type] $name [Description] { path|body|query|head}
**Example:**
string $name user name { body}
Overrides the parameter mapping, defines where to expect the parameter from.
Value should be one of the following
- **path** as part of url
- **query** as part of the query string
- **body** as part of the body of the request
- **head** as part of the http header
Please note that unlike path and head other values are only suggestive and
primarily used by API Explorer to build the interface
##
**Syntax:**
string
string $name [Description] { email|date|datetime|timestamp}
array
array $name [Description] { className}
**Examples:**
string $email email id { email}
Sub types for validation and documentation purpose. Email will validate the
given string as email. Date and datetime will be validated as standard mysql
date formats respectively. Timestamp will be validated as Unix timestamp.
array $author array of Authors { Author}
States that the given array of Author instances.
Take a look at [Type API Class](public/tests/param/Type.php) and tests in
[type.feature](features/tests/param/type.feature)
##
**Syntax:**
string $name [Description] { option1,option2...}
**Example:**
string $gender { male,female,third}
Value for the parameter should match one of the choices, used for validation.
## &
**Syntax:**
string|int|float|array $name [Description] { value}{ value}
**Examples:**
string
string $name 3 to 10 characters in length { 3}{ 10}
array
array $items at least one item is needed { 1}
integer
int $age valid age should be 18 or above { 18}
Minimum and maximum values for a parameter. For string and array parameters
it is applied to the length. For numeric parameters it sets the range for the
value.
Take a look at [MinMax API Class](public/tests/param/MinMax.php) and tests in
[minmax.feature](features/tests/param/minmax.feature)
##
**Syntax:**
string|int|float|array $name [Description] { true}
**Example:**
string $name 3 to 10 characters in length { 10}{ true}
Suggests the validator to attempt fixing the validation problem. In the above
example Validator will trim off the excess characters instead of throwing an
exception
Take a look at [MinMaxFix API Class](public/tests/param/MinMaxFix.php) and
tests in [minmaxfix.feature](features/tests/param/minmaxfix.feature)
##
**Syntax:**
string $name [Description] { /REGEX_HERE/REGEX_OPTIONS}
**Example:**
string $password at least one alpha and one numeric character
{ /^(?:[0-9]+[a-z]|[a-z]+[0-9])[a-z0-9]*$/i}
Used by the validator to make sure the parammeter value matches the regex pattern. It uses preg_match for this verification. Please note that `/` should be used as the delimiter.
Take a look at [MinMaxFix API Class](public/tests/param/Validation.php) and
tests in [minmaxfix.feature](features/tests/param/validation.feature)
##
**Syntax:**
string|int|float $name [Description] { value}
**Example:**
string $password Password
{ Strong password with at least one alpha and one numeric character is required}
Used by the validator to show a custom error message when invalid value is submitted. Use it to list the requirements for a parameter
Take a look at [MinMaxFix API Class](public/tests/param/Validation.php) and
tests in [minmaxfix.feature](features/tests/param/validation.feature)
##
**Syntax:**
string|int|float $name [Description] { value}
**Example:**
string $name Name { Arul Kumaran}
Used by the explorer to prefill the value for the parameter