typescript-json-schema icon indicating copy to clipboard operation
typescript-json-schema copied to clipboard

Record or custom implemented Record not handled

Open gallofeliz opened this issue 2 years ago • 1 comments

Hi,

Here a small example :

interface Truc {
    name: string
}

interface Test {
    myKey: Record<string, Truc>
}

That gives :

{
    "type": "object",
    "properties": {
        "myKey": {
            "$ref": "#/definitions/Record<string,Truc>"
        }
    },
    "required": [
        "myKey"
    ],
    "definitions": {
        "Record<string,Truc>": {
            "type": "object"
        }
    },
    "$schema": "http://json-schema.org/draft-07/schema#"
}
  • The definition name is very ugly (but why not ...)
  • The definition is "object", nothing else. I have no more details.

Do you know why ?

Note : same problem with

interface Dictionary<T> {
    [key: string]: T
}

interface Truc {
    name: string
}

interface Test {
    myKey: Dictionary<Truc>
}

Thanks. Regards

gallofeliz avatar Apr 28 '22 18:04 gallofeliz