Skip to content

Responses with type void caused exception #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
programatix opened this issue Jun 8, 2024 · 0 comments
Open

Responses with type void caused exception #54

programatix opened this issue Jun 8, 2024 · 0 comments
Assignees

Comments

@programatix
Copy link

Describe the bug
Using type void in responses crashed node,js.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the instructions found at https://ts-spec.github.io/tspec/guide/crud-api-example.
  2. For path delete, the responses for 204 is void. 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"

@hyeonss0417 hyeonss0417 self-assigned this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants