Describe the bug
Following the steps at https://typespec.io/docs/
I created a new TypeSpec project in VSCode, which created:
package.json
{
"name": "UserService",
"version": "0.1.0",
"type": "module",
"private": true,
"dependencies": {
"@typespec/compiler": "^1.13.0",
"@typespec/http": "^1.13.0",
"@typespec/rest": "^0.83.0",
"@typespec/openapi": "^1.13.0",
"@typespec/openapi3": "^1.13.0",
"@typespec/http-client-csharp": "^1.0.0-alpha.20260617.4",
"@typespec/http-server-csharp": "^0.58.0-alpha.29"
}
}
main.tsp
import "@typespec/http";
using Http;
@service(#{ title: "Widget Service" })
namespace DemoService;
model Widget {
id: string;
weight: int32;
color: "red" | "blue";
}
model WidgetList {
items: Widget[];
}
@error
model Error {
code: int32;
message: string;
}
model AnalyzeResult {
id: string;
analysis: string;
}
@route("/widgets")
@tag("Widgets")
interface Widgets {
/** List widgets */
@get list(): WidgetList | Error;
/** Read widgets */
@get read(@path id: string): Widget | Error;
/** Create a widget */
@post create(@body body: Widget): Widget | Error;
/** Update a widget */
@patch update(@path id: string, @body body: MergePatchUpdate<Widget>): Widget | Error;
/** Delete a widget */
@delete delete(@path id: string): void | Error;
/** Analyze a widget */
@route("{id}/analyze") @post analyze(@path id: string): AnalyzeResult | Error;
}
tspconfig.yml
kind: project
emit:
- "@typespec/openapi3"
- "@typespec/http-client-csharp"
- "@typespec/http-server-csharp"
options:
"@typespec/openapi3":
emitter-output-dir: "{output-dir}/schema"
openapi-versions:
- 3.1.0
"@typespec/http-client-csharp":
emitter-output-dir: "{output-dir}/clients/csharp"
"@typespec/http-server-csharp":
emitter-output-dir: "{output-dir}/server/aspnet"
# entrypoint: main.tsp # Main TypeSpec file (default: main.tsp)
# extends: ../tspconfig.yaml # Extend another config file
# emit: # Emitter name
# - "<emitter-name"
# options: # Emitter options
# <emitter-name>:
# "<option-name>": "<option-value>"
# environment-variables: # Environment variables which can be used to interpolate emitter options
# <variable-name>:
# default: "<variable-default>"
# parameters: # Parameters which can be used to interpolate emitter options
# <param-name>:
# default: "<param-default>"
# trace: # Trace areas to enable tracing
# - "<trace-name>"
# warn-as-error: true # Treat warnings as errors
# output-dir: "{project-root}/_generated" # Configure the base output directory for all emitters
I then selected '.NET server code emitter', and got
js-error: Failed to load c:/Users/me/Repositories/typespec/node_modules/@typespec/http-server-csharp/dist/src/index.js due to the following JS error: The requested module '@typespec/emitter-framework/csharp' does not provide an export named 'getDocComments'
Reproduction
Create a new typespec project and try to emit .net server.
Checklist
Describe the bug
Following the steps at https://typespec.io/docs/
I created a new TypeSpec project in VSCode, which created:
package.json
{ "name": "UserService", "version": "0.1.0", "type": "module", "private": true, "dependencies": { "@typespec/compiler": "^1.13.0", "@typespec/http": "^1.13.0", "@typespec/rest": "^0.83.0", "@typespec/openapi": "^1.13.0", "@typespec/openapi3": "^1.13.0", "@typespec/http-client-csharp": "^1.0.0-alpha.20260617.4", "@typespec/http-server-csharp": "^0.58.0-alpha.29" } }main.tsp
tspconfig.yml
I then selected '.NET server code emitter', and got
Reproduction
Create a new typespec project and try to emit .net server.
Checklist