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]: OpenAPI 3 Emitter crash on @useAuth({}) #4097

Closed
4 tasks done
Tracked by #3836
skywing918 opened this issue Aug 6, 2024 · 0 comments · Fixed by #4133
Closed
4 tasks done
Tracked by #3836

[Bug]: OpenAPI 3 Emitter crash on @useAuth({}) #4097

skywing918 opened this issue Aug 6, 2024 · 0 comments · Fixed by #4133
Assignees
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter triaged:core

Comments

@skywing918
Copy link
Member

Describe the bug

OpenAPI 3 Emitter crash on @useAuth({}).

TSP

import "@typespec/http";

using TypeSpec.Http;
@service
@useAuth({})
namespace Security;

Internal Compiler Error

Internal Compiler Error
ExternalError: Emitter "@typespec/openapi3" crashed! This is a bug.
Please file an issue at https://github.com/microsoft/typespec/issues

TypeError: Cannot read properties of undefined (reading 'add')
    at getOpenAPI3SchemeInternal (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:7080:29)
    at getOpenAPI3Scheme (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:7046:24)
    at getOpenAPISecuritySchemes (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:7010:28)
    at initializeEmitter (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:5778:33)
    at getOpenApiFromVersion (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:6149:13)
    at getProjectedOpenAPIDocument (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:5931:36)
    at getOpenAPI (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:5882:40)
    at Object.emitOpenAPI (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:5731:32)
    at Object.$onEmit [as emitFunction] (https://typespec.blob.core.windows.net/pkgs/@typespec/openapi3/0.58.0/index.js:5650:19)
    at runEmitter (https://typespec.blob.core.windows.net/pkgs/@typespec/compiler/0.58.1/index.js:6512:27)

--------------------------------------------------
Library Version                0.58.0
TypeSpec Compiler Version      0.58.1
--------------------------------------------------

Reproduction

Playground

Checklist

@skywing918 skywing918 added the bug Something isn't working label Aug 6, 2024
@markcowl markcowl added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Aug 12, 2024
@markcowl markcowl added this to the [2024] September milestone Aug 12, 2024
github-merge-queue bot pushed a commit that referenced this issue Aug 28, 2024
OpenAPI 3 Emitter crash on @useAuth({}). 
seems the diagnostics is not initial before add item. 

fix: #4097

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Christopher Radek <14189820+chrisradek@users.noreply.github.com>
weidongxu-microsoft pushed a commit to weidongxu-microsoft/typespec that referenced this issue Sep 3, 2024
OpenAPI 3 Emitter crash on @useAuth({}). 
seems the diagnostics is not initial before add item. 

fix: microsoft#4097

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Christopher Radek <14189820+chrisradek@users.noreply.github.com>
sarangan12 pushed a commit to sarangan12/typespec that referenced this issue Sep 16, 2024
OpenAPI 3 Emitter crash on @useAuth({}). 
seems the diagnostics is not initial before add item. 

fix: microsoft#4097

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Christopher Radek <14189820+chrisradek@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter triaged:core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants