ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

Not following JS spec

Open qwelias opened this issue 3 years ago • 1 comments

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

qwelias avatar Aug 06 '22 17:08 qwelias