krg7880 / json-schema-generator

Generates draft v4 schema from a local file or a remote JSON url.
MIT License
174 stars 53 forks source link

"Maximum call stack size exceeded" when type is object #17

Open pallix opened 8 years ago

pallix commented 8 years ago

When validating the following schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "event_type": {
            "type": "string"
        },
        "dependencies_type": {
            "type": "string"
        },
        "agent_type": {
            "type": "string"
        },
        "key": {
            "type": "string"
        },
        "node": {
            "type": "object",
            "properties": {
                "parent_id": {
                    "type": "string"
                },
                "value": {
                    "type": "object"
                },
                "id": {
                    "type": "string"
                }
            },
            "required": [
                "parent_id",
                "value",
                "id"
            ]
        }
    },
    "required": [
        "event_type",
        "node",
        "key",
        "dependencies_type",
        "agent_type"
    ]
}

The error below occurs. This is due to the type of the "value" field being "object".

RangeError: Maximum call stack size exceeded
    at String.replace (native)
    at new URLUtils (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/util/helpers.js:9:23)
    at new URLUtils (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/util/helpers.js:24:16)
    at parseURI (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/util/helpers.js:77:10)
    at Object.resolveURL (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/util/helpers.js:83:10)
    at Object.module.exports [as normalizeSchema] (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/util/normalize-schema.js:56:12)
    at /home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/index.js:59:18
    at Array.forEach (native)
    at $ref (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/node_modules/deref/lib/index.js:58:35)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/node_modules/json-schema-faker/lib/jsf.js:19:21)
    at generateForProp (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:41:11)
    at generateNegativeType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:81:11)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:389:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)
    at generateNegativeDetailsForType (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:371:44)
    at generateForTypes (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:390:44)
    at generate (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:452:42)
    at generateNegativesForObject (/home/miaou/projects/events/couchapp-dependencies/node_modules/json-schema-test-data-generator/dist/index.js:320:22)npm ERR! Test failed.  See above for more details.