1.15.0
Breaking Changes
Section titled “Breaking Changes”@typespec/compiler
Section titled “@typespec/compiler”-
#11552
usingstatements declared before a file-level(blockless) namespace are now resolved from the global namespace instead of the file namespace, matching C#.using TypeSpec.Http; // Now resolves the global `TypeSpec` namespace instead of `_Specs_.TypeSpec`namespace _Specs_.TypeSpec.Foo;A
usingdeclared after the file namespace, or inside a namespace block, is unchanged and still resolves relative to that namespace. Code relying on a relative name in ausingwritten above the file namespace must now use the fully qualified name.namespace MyOrg.Service;using Models; // Still resolves to `MyOrg.Models`
Features
Section titled “Features”@typespec/compiler
Section titled “@typespec/compiler”-
#11476 Add back empty project template to
tsp initoptions# Result of selecting "Empty project" in tsp init# main.tsp - minimal empty file to start from -
#11000 Add
setAutoDecoratorAPI to programmatically apply anautodecorator to a target, mirroring what the synthesizedauto decimplementation does when the decorator is written in source. This lets emitters and mutators mark synthetic types without reaching into the program state map directly.import { setAutoDecorator } from "@typespec/compiler";setAutoDecorator(program, "MyLib.myFlag", target); -
#11468 Add
Fix all: Xcode action for codefixes that can be applied to multiple instances in a file at once. When a codefix applies to more than one diagnostic of the same kind in a file, aFix all: <fix label>quick fix action is now suggested alongside the individual fix. -
#11209 Add support for short diagnostic and linter rule names. Diagnostic/rule codes can now be referenced by their scope-stripped short name (e.g.
http/no-fooinstead of@typespec/http/no-foo) or by a library-declaredalias, both in#suppressdirectives and in thelintersection oftspconfig.yaml. The full name is always accepted.model Post {#suppress "http/no-service-found" "standard library route"author: LegacyUser;}Libraries can declare a custom alias:
export const $lib = createTypeSpecLibrary({name: "@azure-tools/typespec-client-generator-core",alias: "tcgc",diagnostics: {/* ... */},} as const);An
aliasmust be kebab-case (lowercase letters, digits, and hyphens). When two loaded libraries would resolve to the same short name, that short name is ambiguous: referencing it (in a#suppressdirective or thelinterconfig) reports a warning and the full name must be used. -
#11366 Language server folding ranges now report a
kind: comments fold ascommentand consecutiveimportstatements fold together as animportsregion. This enables editor commands such as “Fold All Block Comments” and “Fold All Imports” to work with TypeSpec files. -
#11318 Add
currentStageproperty anduseCachemethod toProgramfor stage-aware caching.currentStagetracks the compilation pipeline stage (parsing → checking → validating → linting → emitting), anduseCacheprovides a generic caching mechanism that libraries can use to avoid redundant computation during later stages. -
#11221 Add a
docsfield to linter rule and diagnostic definitions to provide extended reference documentation. The value can be an inline markdown string or aFileRefcreated withfileRef.fromPackageRoot("src/rules/my-rule.md"), which is read lazily by tooling so it stays safe to bundle for the browser.export const myRule = createRule({name: "my-rule",severity: "warning",description: "Short description.",docs: fileRef.fromPackageRoot("src/rules/my-rule.md"),messages: {/* ... */},}); -
#11000
createTesternow mounts each discovered library’stspconfig.yamlinto the virtual file system, so experimental features a library opts into (e.g.auto-decorators) are honored when compiling against the tester.
@typespec/http
Section titled “@typespec/http”- #11318 Cache
getHttpOperationresults during linting and emitting stages usingprogram.useCache(). This eliminates redundant route resolution when multiple linter rules inspect the same operations, improving linter performance on large specs. - #11153 Add scope support to
OpenIdConnectAuth. The model now accepts an optionalScopestemplate parameter (OpenIdConnectAuth<ConnectUrl, Scopes>) and the OpenAPI3 emitter emits those scopes on each operation’sopenIdConnectsecurity requirement. The scheme object itself remains unchanged (scopes are discovered via theopenIdConnectUrl). ExistingOpenIdConnectAuth<Url>usages are unaffected.
@typespec/openapi
Section titled “@typespec/openapi”-
#11309 Add
identifierfield to theLicensemodel in@typespec/openapi. This is an SPDX license expression for the API (e.g."MIT","Apache-2.0"). Theidentifierandurlfields are mutually exclusive. For OpenAPI 3.1+,identifieris emitted as-is; for OpenAPI 3.0, it is emitted as thex-oai-license-identifierextension. Importing an OpenAPI document also supports reading backidentifier(orx-oai-license-identifierfor 3.0 documents).@info(#{ license: #{ name: "MIT", identifier: "MIT" } })namespace MyService;
@typespec/openapi3
Section titled “@typespec/openapi3”-
#11309 Add
identifierfield to theLicensemodel in@typespec/openapi. This is an SPDX license expression for the API (e.g."MIT","Apache-2.0"). Theidentifierandurlfields are mutually exclusive. For OpenAPI 3.1+,identifieris emitted as-is; for OpenAPI 3.0, it is emitted as thex-oai-license-identifierextension. Importing an OpenAPI document also supports reading backidentifier(orx-oai-license-identifierfor 3.0 documents).@info(#{ license: #{ name: "MIT", identifier: "MIT" } })namespace MyService; -
#11154 Extend the
enum-strategy: annotatedemitter option to unions of literals. When set toannotated, a union whose variants are literals is emitted as aoneOf/anyOfofconstsubschemas with per-varianttitle/descriptiontaken from@summaryand@doc, instead of collapsing to a single lossyenum. Supported for OpenAPI 3.1.0 and above; emitting with OpenAPI 3.0.0 falls back to the default form and reports a warning.For example, the following TypeSpec:
/** Set of known error types. */union ErrorType {/** Common error for a bad request. */@summary("CommonBadRequest")commonBadRequest: "https://example.com/errors/bad-request",/** The request body could not be parsed. */@summary("InvalidBody")invalidBody: "https://example.com/errors/invalid-body",}emits:
ErrorType:description: Set of known error types.anyOf:- const: https://example.com/errors/bad-requesttitle: CommonBadRequestdescription: Common error for a bad request.- const: https://example.com/errors/invalid-bodytitle: InvalidBodydescription: The request body could not be parsed.Use
@oneOfon the union to emitoneOfinstead ofanyOf. -
#11153 Add scope support to
OpenIdConnectAuth. The model now accepts an optionalScopestemplate parameter (OpenIdConnectAuth<ConnectUrl, Scopes>) and the OpenAPI3 emitter emits those scopes on each operation’sopenIdConnectsecurity requirement. The scheme object itself remains unchanged (scopes are discovered via theopenIdConnectUrl). ExistingOpenIdConnectAuth<Url>usages are unaffected.
Bug Fixes
Section titled “Bug Fixes”@typespec/compiler
Section titled “@typespec/compiler”- #11477 Fix decorators running with unresolved template parameters when a decorated template is used as a template parameter default of an operation (e.g.
op foo<Resource, Properties = Decorated<Resource>>(...), the ARMTagsUpdateModel<Resource>pattern). Operations now enter the template declaration scope before resolving template parameter defaults, so decorators on those defaults are no longer executed with the still-unresolved template parameter. This matches the existing behavior for models and interfaces. - #11423
tsp compile .now resolves the entrypoint fromexports["."]["typespec"]in package.json, taking precedence over the legacytspMainfield - #11485 Report better error message when specifying an emitter that is not installed with
--emitflag - #11426 IDE completion no longer adds unnecessary backticks when completing keyword identifiers in positions where they are allowed (model properties, object literal properties, member expressions).
- #11467
tsp inittemplatecompilerVersionfield now supports semver ranges (e.g.,^0.50.0). Plain versions like1.2.3continue to work as>=1.2.3for backward compatibility.
@typespec/openapi3
Section titled “@typespec/openapi3”- #11427 Fix duplicate type name error when a model with a
@visibility(Lifecycle.Create, Lifecycle.Update)property extends another model. - #11538 [converter] Convert query parameters using
spaceDelimited/pipeDelimitedstyles to@encode(ArrayEncoding.spaceDelimited)/@encode(ArrayEncoding.pipeDelimited)instead of dropping them, including whenexplode: trueis set
@typespec/json-schema
Section titled “@typespec/json-schema”- #11505 Use explicit
@idvalues for bundled $defs keys to avoid silent overwrites.
typespec-vscode
Section titled “typespec-vscode”- #11283 Fix a shell command injection in the tsp compile task provider. Tasks now run via
vscode.ProcessExecutionwith arguments passed as an array instead ofvscode.ShellExecution, so workspace file paths and task arguments are no longer interpreted by the OS shell. The taskargsis now specified as an array of arguments.
Features
Section titled “Features”@typespec/library-linter
Section titled “@typespec/library-linter”-
#11543 Add
missing-documentationandextraneous-documentationrulesmissing-documentationreports public declarations and members of a library that have no doc comment or@doc, so gaps in the generated reference documentation are caught at build time.extraneous-documentationreports doc comments that document something that doesn’t exist, such as a@paramnaming a parameter the operation doesn’t have, a@templatecopied from an enclosing interface, or an unescaped code reference the parser mistook for a tag:/*** Creates or updates an instance of the resource.* @template Resource The resource model. // `create` is not templated: the interface is*/create(resource: Resource): Resource;Declarations in a
Privatenamespace and declarations markedinternalare excluded.
Bug Fixes
Section titled “Bug Fixes”@typespec/graphql
Section titled “@typespec/graphql”- #11565 Add
./mutation-enginesubpath export for standalone mutation pipeline usage