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

Bug in enum type processing

Open fbaligand opened this issue 2 years ago • 0 comments

Hi,

Given that I have Entity.ts:

export enum Entity {
	firstValue,
	secondValue
}

Then I execute:

typescript-json-schema Entity.ts *

Expected Result:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "Entity": {
            "enum": [
                "firstValue",
                "secondValue"
            ],
            "type": "string"
        }
    }
}

Actual Result:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "Entity": {
            "enum": [
                0,
                1
            ],
            "type": "number"
        }
    }
}

fbaligand avatar Oct 16 '23 12:10 fbaligand