JSON schema validation

Hi! Is there some support of JSON schemas ( http://json-schema.org/ ) in Phalcon? I see several PHP libraries for this but maybe Phalcon have own implementation? Examples: http://spacetelescope.github.io/understanding-json-schema/reference/array.html

Not sure why you would require a library for JSON as PHP supports this natively, take a look at http://php.net/manual/en/book.json.php

It would help if you could describe what it is you are trying to achieve...

edited Mar '16

JSON schema validation is not the same as validating JSON itself.

Assume we have JSON schema

{
  "username": "string",
  "age": "integer",
  "friends": {
    "type": "array",
    "items": {
      "type": "integer"
    }
  },
  "required": ["username", "age"]
}

It describes that we want to validate object from JSON like this:

{
  "username": "Alex",
  "age": 30
}

So we use library like this https://github.com/justinrainbow/json-schema that accepts JSON schema and our raw input data and we are done.

Not sure why you would require a library for JSON as PHP supports this natively, take a look at http://php.net/manual/en/book.json.php

It would help if you could describe what it is you are trying to achieve...

Sorry I misinterpreted your question, ther eisn't one that is part of Phalcon so you would need to use an external library like the one you posted. If you do decide to create your own you can post it in the phalcon incubator so that it could be included in the base of Phalcon in future or if you understand Zephir you could have a go at implementing one and creating an MR on github

edited Sep '16

Unlike some other lib based frameworks, Phalcon does not have such support.

IMHO this should be addressed ASAP as it is very useful, and I do plan to write Zephir code validator in order to cover official Json schema spec (draft v4).

Untill then, I'm using http://json-guard.thephpleague.com

Hello Everyone,

I am using SSIS SQL to JSON to setup input datasets for JSON Output and pass parameters to source SQL query (Dynamic at runtime).