jsonschema2md icon indicating copy to clipboard operation
jsonschema2md copied to clipboard

Stuck in "generating markdown" step - potential performance issue

Open kevindra opened this issue 4 years ago • 0 comments

What did you do

I have 3 json schema files - A.json, B.json, C.json. A references B and B references C. However, when I run the jsonschema2md command, command gets stuck at the gererating markdown step.

$ jsonschema2md -d . -e json --out ../out
loading 3 schemas
writing schemas
writing schemas to ...
writing README
building readme
writing documentation
generating markdown // stuck here

In my research so far, it seems like this happens when there are too many incoming references to a definition and/or when an array based reference references another array based reference.

Please see the example below of all 3 files, I deliberately added few extra properties extends[n] to the A.json schema, which made the command got stuck. Please help.

What did you expect to happen

Markdown to generate successfully.

What happened

Command got stuck at generating markdown step

What's your environment

  • Operating System: macOs High Sierra 10.13.6
  • node.js version: v14.3.0

Do you have example files:

A.json

{
    "$id": "https://foo.bar/A",
    "$schema": "http://json-schema.org/draft-07/schema#",

    "type": "object",

    "properties": {
        "extends": {
            "type": "array",
            "items": {
                "$ref": "https://foo.bar/B"
            }
        },
        "extends2": {
            "type": "array",
            "items": {
                "$ref": "https://foo.bar/B"
            }
        },
        "extends3": {
            "type": "array",
            "items": {
                "$ref": "https://foo.bar/B"
            }
        },
        "extends4": {
            "type": "array",
            "items": {
                "$ref": "https://foo.bar/B"
            }
        },
        "extends5": {
            "type": "array",
            "items": {
                "$ref": "https://foo.bar/B"
            }
        }
    }
}

B.json

{
    "$id": "https://foo.bar/B",
    "$schema": "http://json-schema.org/draft-07/schema#",
    
    "type": "array",
    "items": {
        "$ref": "https://foo.bar/C"
    }
}

C.json

{
    "$id": "https://foo.bar/C",
    "$schema": "http://json-schema.org/draft-07/schema#",

    "type": "string"
}

kevindra avatar Sep 21 '20 21:09 kevindra