Skip to content
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

[Bug]: Crash when using void or null as body type. #3073

Closed
4 tasks done
LadyCailin opened this issue Mar 28, 2024 · 1 comment · Fixed by #3077
Closed
4 tasks done

[Bug]: Crash when using void or null as body type. #3073

LadyCailin opened this issue Mar 28, 2024 · 1 comment · Fixed by #3077
Assignees
Labels
bug Something isn't working needs-area

Comments

@LadyCailin
Copy link
Contributor

Describe the bug

Error: Unknown intrinsic type void
at OpenAPI3SchemaEmitter.intrinsic (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/openapi3/dist/src/schema-emitter.js:319:15)
at file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:377:55
at withTypeContext (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:520:9)
at invokeTypeEmitter (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:367:9)
at Object.emitType (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:268:28)
at file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:160:37
at withPatchedReferenceContext (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:535:28)
at Object.emitTypeReference (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:142:20)
at OpenAPI3SchemaEmitter.modelPropertyLiteral (file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/openapi3/dist/src/schema-emitter.js:177:40)
at file:///C:/Users/Cailin/OneDrive/Code/CommandHelper/src/main/resources/apps.methodscript.com/node_modules/@typespec/compiler/dist/src/emitter-framework/asset-emitter.js:377:55


Library Version 0.54.0
TypeSpec Compiler Version 0.54.0

Reproduction

https://typespec.io/playground?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7DQp1c2luZyBUeXBlU3BlYy5IdHRwOw0KDQppbnRlcmZhY2UgZm9vIHsNCiAgQGdldCBiYXIoKTrGESAgYm9keTogdm9pZMQQfQ0KfQ%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D

Checklist

@LadyCailin LadyCailin added the bug Something isn't working label Mar 28, 2024
@LadyCailin LadyCailin changed the title [Bug]: Crash when using void as body type. [Bug]: Crash when using void or null as body type. Mar 28, 2024
@timotheeguerin
Copy link
Member

timotheeguerin commented Mar 28, 2024

thanks for the nice repro, it he case of what you were trying to do either you want the response to be exactly void or you should add @body on that property. Here it would mean that there is a property in the body of type void which doesn’t make much sense.

the crash nevertheless shouldn’t be happening and we should give you a better error

@timotheeguerin timotheeguerin self-assigned this Mar 28, 2024
timotheeguerin added a commit that referenced this issue Mar 28, 2024
fix #3073

This still doesn't provide an optimal experience as the error shows up
on the void type instead of where it is referenced but solving that is
that long standing issue about tracing back where an error should be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants