- Virtual Box
- Vagrant >= 2.0
- Plugin vagrant-vbguest (
vagrant plugin install vagrant-vbguest)
git clone https://github.com/jokly/JSON-Sanitizer.gitcd JSON-Sanitizervagrant plugin install vagrant-vbguestvagrant up
vagrant sshcd /vagrantmake testmake coverage
-
Integer
{ "data": "3", "type": "int" } -
Float
{ "data": "-5.3", "type": "float" } -
String
{ "data": "Hello World!", "type": "string" } -
Phone number
{ "data": "8(950)288-56-23", "type": "phone" } -
Array
{ "data": [ { "data": "-5", "type": "int" }, { "data": "3.25", "type": "float" } ], "type": "array" } -
Typed array
{ "data": [ { "data": "Hello", "type": "string" }, { "data": "World!", "type": "string" } ], "type": "array:string" } -
Dictionary
{ "data": { "my_str": { "data": "Hello", "type": "string" }, "secod_el": { "data": "79.1", "type": "float" } }, "type": "dict" }
[
{
"data": "15",
"type": "int"
},
{
"data": "7.1",
"type": "float"
}
]-
InvalidJsonException"Invalid json object" -
UndefinedIndexException"Undefinde index: <index>" -
UnknownTypeException"Unknown type: <type>" -
RequiredTypeException"Element must be of the type <required_type>, <given type> given" -
UnexpectedTypeException"Unexpected type: <type>" -
InvalidTypeException => { InvalidIntException, InvalidFloatException, InvalidPhoneException }"Invalid <expected type: integer/float/phone>: <invalid data>"
{
"errors": [
{
"msg": "Undefinde index: 'data'"
},
{
"msg": "Invalid 'integer': '5.1'"
}
]
}