Crash for deprecated field missing description
danmichaelo opened this issue · 1 comments
danmichaelo commented
Minimal example:
{
"type": "string",
"deprecated": true
}
Using json-schema-to-typescript 13.1.0
import { compileFromFile } from "json-schema-to-typescript";
const ts = await compileFromFile("minimal.json");
Causes the following crash:
./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/generator.js:292
commentLines.push.apply(commentLines, comment.split('\n').map(function (_) { return ' * ' + _; }));
^
TypeError: Cannot read properties of undefined (reading 'split')
at generateComment (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/generator.js:292:51)
at generateStandaloneType (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/generator.js:318:43)
at declareNamedTypes (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/generator.js:106:53)
at generate (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/generator.js:21:9)
at ./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/index.js:161:58
at step (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/index.js:59:23)
at Object.next (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/index.js:40:53)
at fulfilled (./node_modules/.pnpm/json-schema-to-typescript@13.1.0/node_modules/json-schema-to-typescript/dist/src/index.js:31:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Error message is similar to #540, so possible both issues can be fixed together.
bcherny commented
Published 13.1.1.