Skip to content

Commit

Permalink
Merge pull request #10 from darlintonprauchner/feat/create_terminal_p…
Browse files Browse the repository at this point in the history
…arameter

Creates parameter “terminal”
  • Loading branch information
RemyJeancolas authored Dec 13, 2016
2 parents aefc0f8 + 1bed299 commit 0b665b3
Show file tree
Hide file tree
Showing 8 changed files with 304 additions and 101 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ validation: {
arrayType: 'valid type', // optional, default null, only works if 'type' property is 'array', check if the array content has valid types, supported types: 'string', 'number', 'boolean', 'numeric'
values: ['value1', 'value2'], // optional, default null, validates that parameter value belongs to the provided list, if 'type' is 'array', validates every array element
regex: /^Valid regex$/, // optional, default null, validates parameter value against provided regex
terminal: true|false|['type', 'required', 'and so on...'] // optional, default false, when defined as 'true' or array of constraints, returns only error messages associated with this property_name and defined rules
format: function(data): data // Function to transform input after validation, see below for more detail
}
}
Expand Down Expand Up @@ -229,6 +230,8 @@ validator.disableFailOnFirstError();
server.use(validator.validate.bind(validator));
```
It is still possible to determine which errors should be returned individually when `disableFailOnFirstError` is activated. In order to do so, one should define the parameter `terminal` on each property being validated.
## Development
### Installation
Expand Down
1 change: 1 addition & 0 deletions js/ParamValidation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/ParamValidation.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 75 additions & 37 deletions js/RequestValidator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b665b3

Please sign in to comment.