Skip to content

Feature: tspconfig project with entrypoint#10548

Open
timotheeguerin wants to merge 10 commits intomicrosoft:mainfrom
timotheeguerin:feature/project-config
Open

Feature: tspconfig project with entrypoint#10548
timotheeguerin wants to merge 10 commits intomicrosoft:mainfrom
timotheeguerin:feature/project-config

Conversation

@timotheeguerin
Copy link
Copy Markdown
Member

No description provided.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the compiler:core Issues for @typespec/compiler label Apr 29, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 29, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@10548

commit: 6353917

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Add kind: project and entrypoint support to tspconfig.yaml for defining project boundaries and entrypoint resolution. See Project Configuration for more details.,> ,> yaml title=tspconfig.yaml,> kind: project,> entrypoint: src/service.tsp,> emit:,> - "@typespec/openapi3",>

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Apr 29, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@microsoft-github-policy-service microsoft-github-policy-service Bot added the meta:website TypeSpec.io updates label Apr 29, 2026
Copy link
Copy Markdown
Contributor

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we should eventually change the structure of azure-rest-api-specs typespec projects?

The behavior here is that, if there is a project tspconfig.yaml in the path ancestors of the command line path, the config entrypoint will always be used. I think this either means that all azure-rest-api-specs configs should not use project configs, or that we need another project config for client customizations in another directory, and TypeSpecValidation will have to be changed accordingly.

Am I getting the behavior wrong, or is this the intention?

}

// Validate project-specific constraints
if (data.kind === "project" && getBaseFileName(filename) !== TypeSpecConfigFilename) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just defense in depth? what is the context in which we could be loading config and it's not from a tspconfig file, since we are already checking that --config provided config cannot be project config?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah didn't think that it probably doesn't seem possible via compile but might be via ide(you open a tspconfig.foo.yaml with kind: project)

message: `project tspconfig found in ${dir}, entrypoint: ${entrypoint}`,
});
// Project boundary found — stop walking regardless of whether entrypoint exists
return candidate ?? (isFilePath ? path : undefined);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to override a passed-in entryPoint path? It seems like the command line entry point should override config settings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hhm yeah good point

Copy link
Copy Markdown
Member Author

@timotheeguerin timotheeguerin May 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I bevlive this is the source of your other comment. It would be I think the plan that we add that for every project in azure rest api specs repo but not sure I see it as a requirement yet.
tsp compile should always respect that path. If it points to a tsp file, it MUST be the entrypoint. if it points to a folder then we try but only in that folder (no walk up)

  • tspconfig proejct -> entrypoint
  • package.json -> tspmain/exports
  • ./main.tsp

which means in specs repo we should be fine having the same structure just with added

kind: project
entrypoint: ./main.tsp # if we want to be explicit
tsp compile ./specification/foo/bar # compiles main.tsp
tsp compile ./specific/foo/bar/client.tsp # compile client.tsp

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and actually this is fine, the behavior in this file is just for LSP, we use a different logic for tsp compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants