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

Not following JS spec #492

Open qwelias opened 2 years ago

qwelias commented 2 years ago

Support toJSON method on objects is required for accurate JS/TS to JSON translation. toJSON can define custom representation of any JS object wich may not match the object itself. If toJSON is not respected by JSON schema generators then generated schema may deviate from actual JSON representation of a JS object.

Example: https://github.com/mongodb/js-bson/blob/main/src/objectid.ts#L202