Releases: microsoft/typespec
typespec-stable@1.12.0
@typespec/compiler
Features
-
#10558 Improve formatting of union expressions
-
#10352 Add support for configurable options on linter rules
Linter rules can now define typed options with defaults using
defaultOptions, and users can pass options when enabling rules intspconfig.yamlor rulesets.Defining a rule with options:
const myRule = createRule({ name: "no-model-with-name", severity: "warning", description: "Bans models with a specific name", messages: { default: "This model name is not allowed" }, defaultOptions: { bannedName: "Foo" }, create(context) { return { model: (target) => { if (target.name === context.options.bannedName) { context.reportDiagnostic({ target }); } }, }; }, });
Configuring options in
tspconfig.yaml:linter: enable: # Enable with default options "@typespec/my-lib/no-model-with-name": true # Enable with custom options "@typespec/my-lib/no-model-with-name": bannedName: "Bar"
-
#10431 [init] Package dependencies are now populated with the actual latest version at the time (e.g.
^1.11.0) -
#10581 Added warnings for duplicate imports and self-imports in the same file
The compiler now warns when a file imports itself or contains duplicate import statements. These are likely mistakes and while they don't cause errors, they add unnecessary noise.
import "./main.tsp"; // Warning: A file cannot import itself. import "./other.tsp"; import "./other.tsp"; // Warning: Duplicate import of "./other.tsp"
Bug Fixes
- #10618 [LSP] Fix code fixes often not running when selected
- #10567 Fix server crashes caused by undefined symbol declarations: add null checks for
getSymNode()in hover, completion, type-details, and type-signature handlers, and use fallback name for empty DocumentSymbol names - #10351 Fix formatter crash when an operation's parameter list contains only a block comment (e.g.
op find(/* conditions */): unknown;). Dangling comments in empty parameter lists are now preserved instead of being dropped. - #10556 Fix formatting of decorators on operations and augment decorators. Decorators on operations now break to separate lines when the total line exceeds the print width. Augment decorator arguments are now consistently indented when the line breaks, matching TypeScript/prettier function call formatting.
- #10580 Hide cursor during spinner animation to prevent flicker on Windows
@typespec/http
Deprecations
-
#9884 Deprecate use of
@patch(#{implicitOptionality: true}).Migrate using one of the following patterns depending on intended semantics:
- Preserve previous behavior with an explicit patch model (optional properties)
model Pet { name: string; age: int32; } + model PetPatch { + name?: string; + age?: int32; + } - @patch(#{implicitOptionality: true}) op updatePet(@body patch: Pet): void; + @patch op updatePet(@body patch: PetPatch): void;- Use merge-patch semantics explicitly with
MergePatchUpdate<T>
model Pet { name: string; age: int32; } @patch op updatePet(@body patch: MergePatchUpdate<Pet>): void;
Use
MergePatchCreateOrUpdate<T>when the operation supports create-or-update behavior.
Features
- #10180 [API] Operation returning a union of types without status code or content type will be treated as a single response
@typespec/openapi
No changes, version bump only.
@typespec/openapi3
Bug Fixes
- #10180 Fix examples when operation return type have union of response mapping to same status code
- #10268 Fix missing discriminator mapping entry when the first union variant causes a circular emit, affecting both the OpenAPI 3.0 and 3.2 emitters.
@typespec/json-schema
No changes, version bump only.
typespec-vscode
Bug Fixes
- #10567 Handle unhandled exceptions in VS Code extension: add custom error handler for server crashes with restart notification, wrap commands with graceful exception handling, and add null guards to prevent extension host errors when LSP client is unavailable
- #10523 Show "Launching TypeSpec language service..." progress in the status bar instead of as a notification to avoid blocking the UI
- #10527 Ensure operation telemetry events always carry a valid
resultvalue. Previously thestart-extensionevent (and any other operation whose callback returnedvoid) was sent withresult="undefined"and classified as an error event. ThedoOperationWithTelemetrycallback is now constrained to returnResultCode | Result<...>, so the result is always derived from the operation's return value.
@typespec/prettier-plugin-typespec
No changes, version bump only.
@typespec/xml@0.82.0
No changes, version bump only.
@typespec/versioning@0.82.0
No changes, version bump only.
@typespec/tspd@0.74.2
Bug Fixes
- #10501 Fix broken (404) links to linter rule pages on auto-generated linter reference pages. The links no longer drop the website base path.
@typespec/streams@0.82.0
No changes, version bump only.
@typespec/sse@0.82.0
No changes, version bump only.
@typespec/rest@0.82.0
No changes, version bump only.
@typespec/protobuf@0.82.0
Features
-
#10598 Map TypeSpec optionality (
?) to protobufoptionalwhere appropriate.optionalis applied to fields with protobuf scalar types to set explicit presence.optionalis not applied to fields with message types, because they always have explicit presence.- Attempting to convert a TypeSpec optional property where the type is an array or
Protobuf.Mapinstance produces a warning, because protobuf cannot differentiate between "empty" and "unset"repeated/map-typed fields.
@typespec/playground@0.15.0
Breaking Changes
- #10468 Remove the
newChangeDiffemitter option. Diff highlighting of changed files and lines is now always enabled in the output viewer.
Features
- #10349 Add compilation spinner, diff highlighting, and output preservation
Bug Fixes
- #10442 Fix line-level diff highlighting not appearing in the playground output editor, and reduce typing freezes by coalescing recompilations triggered while a compile is already running.
@typespec/library-linter@0.82.0
No changes, version bump only.