-
Notifications
You must be signed in to change notification settings - Fork 387
Support libraries using auto decorators in tspd #11813
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
Merged
Timothee Guerin (timotheeguerin)
merged 2 commits into
microsoft:main
from
timotheeguerin:tspd-auto-decorator-support
Sep 4, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
.chronus/changes/graphql-regen-auto-accessor-docs-2026-9-2.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| changeKind: internal | ||
| packages: | ||
| - "@typespec/graphql" | ||
| --- | ||
|
|
||
| Regenerate the decorator signatures to pick up the doc comments now emitted for auto decorator | ||
| accessors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| changeKind: fix | ||
| packages: | ||
| - "@typespec/tspd" | ||
| --- | ||
|
|
||
| Document the generated auto decorator accessors, so libraries re-exporting them satisfy | ||
| api-extractor's `ae-undocumented` rule. `get*` and `set*` accessors carry the description of the | ||
| decorator they read or write; `is*` accessors get a generic one, since a decorator description | ||
| does not describe a boolean check. | ||
|
|
||
| ```ts | ||
| /** Check if the `@TypeSpec.GraphQL.inputType` decorator was applied on the given target. */ | ||
| export function isInputType(program: Program, target: Model): boolean { | ||
| return hasAutoDecorator(program, "TypeSpec.GraphQL.inputType", target); | ||
| } | ||
|
|
||
| /** Mark a model as a GraphQL input type in the emitted schema. */ | ||
| export function setInputType(program: Program, target: Model): void { | ||
| setAutoDecorator(program, "TypeSpec.GraphQL.inputType", target); | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| changeKind: fix | ||
| packages: | ||
| - "@typespec/tspd" | ||
| --- | ||
|
|
||
| Honor the library's own `tspconfig.yaml` when generating signatures and reference documentation, so | ||
| libraries that opt into a compiler feature (such as `auto-decorators`) no longer report errors during | ||
| `gen-extern-signature` and `doc`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { | ||
| resolveCompilerOptions, | ||
| type CompilerHost, | ||
| type CompilerOptions, | ||
| } from "@typespec/compiler"; | ||
|
|
||
| /** | ||
| * Resolve the compiler options from the library's own `tspconfig.yaml`, so that features it opts | ||
| * into (such as `auto-decorators`) apply when tspd compiles it. | ||
| * | ||
| * tspd only ever inspects a library, so emitting is always disabled. | ||
| */ | ||
| export async function resolveLibraryCompilerOptions( | ||
| host: CompilerHost, | ||
| entrypoint: string, | ||
| ): Promise<CompilerOptions> { | ||
| const [options] = await resolveCompilerOptions(host, { cwd: process.cwd(), entrypoint }); | ||
| return { ...options, noEmit: true }; | ||
|
timotheeguerin marked this conversation as resolved.
|
||
| } | ||
|
timotheeguerin marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.