28
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "my json api",
    "description": "my json api",
    "type": "object",
    "properties": {
        "my_api_response": {
           "type": "object",
            "properties": {
                "MailboxInfo": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "ADSyncLinkEnabled": {
                                "type": "any"
                            }
                        }
                    }
                }
            }
        }
    },
    "required": ["response"]
}

I am using python jsonschema 2.0.0 and it gives me the following error:

{u'type': u'object', u'properties': {u'ADSyncLinkEnabled': {u'type': u'any'}}} is not valid under any of the given schemas
tadasajon
  • 14,276
  • 29
  • 92
  • 144

2 Answers2

56

This is because any is no longer a valid value for the type keyword.

If you want a schema which matches everything, just use the empty schema: {}.

fge
  • 119,121
  • 33
  • 254
  • 329
  • Thanks. Also -- since you are an expert -- any ideas on this question: http://stackoverflow.com/questions/16825108/json-schema-how-do-i-specify-that-a-boolean-value-must-be-false ? – tadasajon May 30 '13 at 00:50
9

From json-schema.org documentation, we find this regarding "type" property:

If it is an array, it must be an array of strings, where each string is the name of one of the basic types, and each element is unique. In this case, the JSON snippet is valid if it matches any of the given types.

So, another way to achieve a sort of "any" type, you might include all json types:

"type":["number","string","boolean","object","array", "null"]
Reinsbrain
  • 2,235
  • 2
  • 23
  • 35