Responses with type void caused exception
Opened this issue · 0 comments
programatix commented
Describe the bug
Using type void
in responses crashed node,js.
To Reproduce
Steps to reproduce the behavior:
- Follow the instructions found at https://ts-spec.github.io/tspec/guide/crud-api-example.
- For path
delete
, the responses for204
isvoid
. It crashed node.js
Expected behavior
No crash.
Exception
...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:470
throw new Error("Not supported: root type undefined");
^
Error: Not supported: root type undefined
at JsonSchemaGenerator.getDefinitionForRootType (...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:470:27)
at JsonSchemaGenerator.getTypeDefinition (...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:1120:26)
at JsonSchemaGenerator.getDefinitionForProperty (...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:591:31)
at ...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:905:37
at Array.reduce (<anonymous>)
at JsonSchemaGenerator.getClassDefinition (...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:903:45)
at JsonSchemaGenerator.getTypeDefinition (...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:1134:26)
at JsonSchemaGenerator.getDefinitionForProperty (...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:591:31)
at ...\node_modules\typescript-json-schema\dist\typescript-json-schema.js:905:37
at Array.reduce (<anonymous>)
Node.js v22.2.0
Desktop (please complete the following information):
- OS: Windows
- Browser: Chrome
Versions
"tspec": "^0.1.114"
"typescript": "^5.4.5"