YousefED / typescript-json-schema

Generate json-schema from your Typescript sources
BSD 3-Clause "New" or "Revised" License
3.17k stars 323 forks source link

Upgrade to 0.62.0 or 0.63.0 destroys enum definitions #592

Open schreckstefan opened 9 months ago

schreckstefan commented 9 months ago

Hi! We are using typscript-json-schema for a while and it fits to our needs. But when we tried an upgrade to version 0.62.0 it showed that many enum definitions had been deleted from the resulting schema. We thus postponed the upgrade, I tried now again with version 0.63.0. Here, most enums are back again, but there is still a gap. One example: image

The left side shows the old result, from version 0.57.0 The right side shows the result from 0.63.0.

Obviously there is a remaining problem in case of arrays of enum values. In the given case, the original definition is:

 selectedValues?: DateRangeType[];
 ...
 export const enum DateRangeType {
    DATERANGE = 'DATERANGE',
    DATE = 'DATE',
    FROM = 'FROM',
    TO = 'TO',
    DAYS = 'DAYS',
    LASTDAYS = 'LASTDAYS',
    LASTWEEKS = 'LASTWEEKS',
    WEEK = 'WEEK',
    LASTMONTHS = 'LASTMONTHS',
    MONTH = 'MONTH',
 ...