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]: When main.tsp only contain minimal import, emitter fails #5419

Open
4 tasks done
allenjzhang opened this issue Dec 20, 2024 · 3 comments
Open
4 tasks done

[Bug]: When main.tsp only contain minimal import, emitter fails #5419

allenjzhang opened this issue Dec 20, 2024 · 3 comments
Labels
bug Something isn't working emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Comments

@allenjzhang
Copy link
Member

Describe the bug

Right after tsp init with empty project that only, npx tsp compile . fails.

Emitter "@typespec/http-client-csharp" crashed! This is a bug.
Please file an issue at https://github.com/Microsoft/typespec/issues

Error: Root client not found
    at getRootApiVersions (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/http-client-csharp/dist/emitter/lib/client-model-builder.js:130:15)
    at createModel (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/http-client-csharp/dist/emitter/lib/client-model-builder.js:23:11)
    at Object.$onEmit [as emitFunction] (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/http-client-csharp/dist/emitter/emitter.js:44:22)
    at async runEmitter (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/compiler/dist/src/core/program.js:366:13)
    at async compile (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/compiler/dist/src/core/program.js:123:9)
    at async compileOnce (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/compiler/dist/src/core/cli/actions/compile/compile.js:36:25)
    at async compileAction (file:///C:/github/typespec-e2e-demo/sandbox/junk/node_modules/@typespec/compiler/dist/src/core/cli/actions/compile/compile.js:19:9)

main.tsp only contains following:

import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi3";

Reproduction

In E2E repo,

cd sandbox
md [project] && cd [project]
npx tsp init ../../tsptemplate.json
npm install
npx tsp compile .

Checklist

@allenjzhang allenjzhang added bug Something isn't working emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp labels Dec 20, 2024
@ArthurMa1978
Copy link
Member

We should verify if this issue exists in other languages too.

@rs-jayanth
Copy link

http-client-java compiles, but csharp and python client doesn't. There's an open issue - 5363

@msyyc
Copy link
Contributor

msyyc commented Dec 26, 2024

For python, it was already fixed by #5200 so please try latest https://www.npmjs.com/package/@typespec/http-client-python.

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:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp
Projects
None yet
Development

No branches or pull requests

4 participants