Skip to content

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

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

Closed
guillemdc opened this issue Sep 30, 2014 · 2 comments
Closed

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

guillemdc opened this issue Sep 30, 2014 · 2 comments

Comments

@guillemdc
Copy link

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))

@Reggino
Copy link

Reggino commented Oct 2, 2014

The error seems pretty verbose, there is something wrong with schema provided...

What is the output of var_dump($schema) ? (the provided schema to the check() method?)

@bighappyface
Copy link
Collaborator

Closing due to age. Please re-open if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants