Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected exception on complex array validation #6

Open
nohponex opened this issue Jan 22, 2016 · 0 comments
Open

Unexpected exception on complex array validation #6

nohponex opened this issue Jan 22, 2016 · 0 comments
Labels

Comments

@nohponex
Copy link
Member

{
    "type": "object",
    "minProperties": 0,
    "required": [
        "data"
    ],
    "properties": {
        "data": {
            "type": "array",
            "minItems": 0,
            "items": {
                "type": "object",
                "minProperties": 0,
                "required": [
                    "id",
                    "type",
                    "relationships"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "minLength": 0,
                        "pattern": "\/^[1-9][0-9]*$\/",
                        "raw": false
                    },
                    "type": {
                        "type": "string",
                        "minLength": 2,
                        "raw": false
                    },
                    "relationships": {
                        "type": "object",
                        "minProperties": 0,
                        "required": [
                            "myz_template"
                        ],
                        "properties": {
                            "myz_template": {
                                "type": "object",
                                "minProperties": 0,
                                "required": [
                                    "links",
                                    "data"
                                ],
                                "properties": {
                                    "links": {
                                        "type": "object",
                                        "minProperties": 0,
                                        "required": [],
                                        "properties": []
                                    },
                                    "data": {
                                        "type": "object",
                                        "minProperties": 0,
                                        "required": [
                                            "id",
                                            "type"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "string",
                                                "minLength": 0,
                                                "pattern": "\/^[1-9][0-9]*$\/",
                                                "raw": false
                                            },
                                            "type": {
                                                "type": "string",
                                                "minLength": 2,
                                                "raw": false
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "uniqueItems": false
        }
    }
}

NOTE The above validator uses key 'myz_template' but the data contains 'my_template'

PHP Notice:  Undefined offset: 0 in /app/vendor/phramework/validate/src/ArrayValidator.php on line 143
PHP Stack trace:
PHP   1. {main}() /app/vendor/phramework/testphase/bin/testphase:0
PHP   2. Phramework\Testphase\Binary->invoke() /app/vendor/phramework/testphase/bin/testphase:33
PHP   3. Phramework\Testphase\Testphase->run() /app/vendor/phramework/testphase/src/Binary.php:264
PHP   4. Phramework\Testphase\Testphase->handle() /app/vendor/phramework/testphase/src/Testphase.php:321
PHP   5. Phramework\Validate\ObjectValidator->parse() /app/vendor/phramework/testphase/src/Testphase.php:187
PHP   6. Phramework\Validate\BaseValidator->parse() /app/vendor/phramework/validate/src/ObjectValidator.php:287
PHP   7. Phramework\Validate\ObjectValidator->validate() /app/vendor/phramework/validate/src/BaseValidator.php:317
PHP   8. Phramework\Validate\ArrayValidator->validate() /app/vendor/phramework/validate/src/ObjectValidator.php:172
PHP Notice:  Undefined offset: 0 in /app/vendor/phramework/validate/src/ArrayValidator.php on line 143
PHP Stack trace:
PHP   1. {main}() /app/vendor/phramework/testphase/bin/testphase:0
PHP   2. Phramework\Testphase\Binary->invoke() /app/vendor/phramework/testphase/bin/testphase:33
PHP   3. Phramework\Testphase\Testphase->run() /app/vendor/phramework/testphase/src/Binary.php:264
PHP   4. Phramework\Testphase\Testphase->handle() /app/vendor/phramework/testphase/src/Testphase.php:321
PHP   5. Phramework\Validate\ObjectValidator->parse() /app/vendor/phramework/testphase/src/Testphase.php:187
PHP   6. Phramework\Validate\BaseValidator->parse() /app/vendor/phramework/validate/src/ObjectValidator.php:287
PHP   7. Phramework\Validate\ObjectValidator->validate() /app/vendor/phramework/validate/src/BaseValidator.php:317
PHP   8. Phramework\Validate\ArrayValidator->validate() /app/vendor/phramework/validate/src/ObjectValidator.php:172
PHP Notice:  Undefined offset: 0 in /app/vendor/phramework/validate/src/ArrayValidator.php on line 143
PHP Stack trace:
PHP   1. {main}() /app/vendor/phramework/testphase/bin/testphase:0
PHP   2. Phramework\Testphase\Binary->invoke() /app/vendor/phramework/testphase/bin/testphase:33
PHP   3. Phramework\Testphase\Testphase->run() /app/vendor/phramework/testphase/src/Binary.php:264
PHP   4. Phramework\Testphase\Testphase->handle() /app/vendor/phramework/testphase/src/Testphase.php:321
PHP   5. Phramework\Validate\ObjectValidator->parse() /app/vendor/phramework/testphase/src/Testphase.php:187
PHP   6. Phramework\Validate\BaseValidator->parse() /app/vendor/phramework/validate/src/ObjectValidator.php:287
PHP   7. Phramework\Validate\ObjectValidator->validate() /app/vendor/phramework/validate/src/BaseValidator.php:317
PHP   8. Phramework\Validate\ArrayValidator->validate() /app/vendor/phramework/validate/src/ObjectValidator.php:172
E
Test "./tests/tests-api/daemon/trend/get.json" failed with message
 Incorrect parameters
Incorrect:
[
    {
        "type": "object",
        "failure": "properties",
        "properties": {
            "data": {
                "type": "array",
                "failure": "items",
                "items": [
                    [
                        null,
                        null,
                        null
                    ]
                ]
            }
        }
    }
]
@nohponex nohponex added the bug label Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant