Skip to content

I can't get this to work :S #112

Closed
Closed
@guillemdc

Description

@guillemdc

Sorry before hand if this is a totally noob question, but that's what I am and I need help in order to stop being so.

I managed to use the composer and I got a "vendor" folder. I really don't know what to do with it since I don't want to use this as a standalone validator. I want to validate json bodies sent in REST services post methods.

Instead, I'm using the src files, but when I use the code you give as an example (just changing the .json schema and message files for the right inputs) I get this error:

Details
Type: JsonSchema\Exception\InvalidArgumentException
Message: Given schema must be an object in but is a array
File: C:\xampp\htdocs\JsonSchema\Constraints\Undefined.php
Line: 33
#0 C:\xampp\htdocs\JsonSchema\Constraints\Constraint.php(190): JsonSchema\Constraints\Undefined->check(Object(JsonSchema\Constraints\Undefined), Array, '', 'required')
#1 C:\xampp\htdocs\JsonSchema\Constraints\Object.php(117): JsonSchema\Constraints\Constraint->checkUndefined(Object(JsonSchema\Constraints\Undefined), Array, '', 'required')
#2 C:\xampp\htdocs\JsonSchema\Constraints\Object.php(36): JsonSchema\Constraints\Object->validateDefinition(Object(stdClass), Object(stdClass), '')
#3 C:\xampp\htdocs\JsonSchema\Constraints\Constraint.php(158): JsonSchema\Constraints\Object->check(Object(stdClass), Object(stdClass), '', NULL, NULL)
#4 C:\xampp\htdocs\JsonSchema\Constraints\Undefined.php(75): JsonSchema\Constraints\Constraint->checkObject(Object(stdClass), Object(stdClass), '', NULL, NULL)
#5 C:\xampp\htdocs\JsonSchema\Constraints\Undefined.php(49): JsonSchema\Constraints\Undefined->validateTypes(Object(stdClass), Object(stdClass), '', '')
#6 C:\xampp\htdocs\JsonSchema\Constraints\Constraint.php(190): JsonSchema\Constraints\Undefined->check(Object(stdClass), Object(stdClass), '', '')
#7 C:\xampp\htdocs\JsonSchema\Constraints\Schema.php(29): JsonSchema\Constraints\Constraint->checkUndefined(Object(stdClass), Object(stdClass), '', '')
#8 C:\xampp\htdocs\JsonSchema\Validator.php(41): JsonSchema\Constraints\Schema->check(Object(stdClass), Object(stdClass))
#9 C:\xampp\htdocs\index.php(64): JsonSchema\Validator->check(Object(stdClass), Object(stdClass))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions