Skip to content

October 2023

New Features

@typespec/compiler New Features

  • The never type is now assignable to all types.
  • Allow constraint decorators (e.g. @minValue, @maxValue, @maxLength, etc.) to be applied to nullable types.
  • Add support for @returns and @errors doc comment tags.
    • @returns(or @returnsDoc decorator) can be used to describe the success return types of an operation.
    • @errors(or @errorsDoc decorator) can be used to describe the error return types of an operation.
  • Skip emit of deprecated diagnostic for a type reference that is used in a deprecated declaration statement.
  • Improve website performance by removing decorators export and importing decorators individually.

@typespec/http New Features

  • Add support for @returns and @errors doc comment tags.
  • Add support for status code ranges for http responses. Change to API Http responses can now also return a HttpStatusCodeRange object for their status codes.
  • Emit error diagnostic when multiple properties on a response model have the @statusCode decorator.

@typespec/json-schema New Features

  • Disable folding of serialized yaml if line is above 80 characters.

@typespec/openapi New Features

  • Remove @typespec/rest as a peerDependency.
  • Support Http Status Code ranges.
  • Breaking Change Changed namespace from OpenAPI to TypeSpec.OpenAPI.

@typespec/openapi3 New Features

  • Remove @typespec/rest as a peerDependency.
  • Add support for constraints on union types.
  • Add support for @returns and @errors doc comment tags.
  • Add support for http status code ranges.

@typespec/protobuf New features

  • Added support for emitting documentation comments in protobuf specifications.

@typespec/rest New features

  • Remove peer dependency on @typespec/http library.

Bug Fixes

@typespec/compiler Bug Fixes

  • Fix: Correct handling of hyphens in doc comments.
  • Fix: Colorization of line comments extending into the next line.
  • Fix: Crash when using parentheses in directives.
  • Fix: Allow assigning negative and 0 values to float64 types.
  • Fix: Return non-zero format code when tsp formatting fails.
  • Fix: Correct formatting of anonymous unions to exclude leading ’:’ character.
  • Fix: Unions and Enum members are now formatted following the same rules as model properties. An extra line will be added between members if the member is annotated with a decorator, directive or doc comment.
  • Fix: Correct formatting of comments between a directive or doc and its node.
  • Fix: tsp init was not creating the tspconfig.yaml file for templates that specified it.
  • Fix: tsp init will create a placeholder tspconfig.yaml file for templates that don’t specify an explicit one.
  • Fix: tsp init was ignoring the files specified in an init template.
  • Fix: Language Server wasn’t loading the tspconfig.yaml correctly resulting in some options being dropped, like the linter configuration.
  • Fix: Allow null to be assigned as a default value.
  • Fix: Using TypeSpec.Xyz namespace shouldn’t require the TypeSpec Prefix.

@typespec/openapi3 Bug Fixes

  • Fix: Correctly generate discriminated union mapping property with multiple visibilities.
  • Fix: Crash when assigning a numeric default to a union.
  • Fix: Using format ssv or pipes in @header produced an invalid OpenAPI3 schema. It will now change the type to string, ignore the format, and emit a warning diagnostic.
  • Fix: Allow using null as a default value.
  • Fix: Allow use of @oneOf on model properties.
  • Fix: Correct representation of CSV format.
  • Fix: Remove incorrect statusCode field for operations with shared routes.

@typespec/rest Bug Fixes

  • Fix: @key can now appear on the base model of a resource.

@typespec/versioning Bug Fixes

  • Ensure that use of @renamedFrom does not result in duplicate properties on a model.

Breaking Changes

@typespec/http Breaking Changes

  • Http responses can now also return a HttpStatusCodeRange object for their status codes. Emitters will need to handle the additional status code content when processing status codes.
  • Emit error diagnostic when multiple properties on a response model have the @statusCode decorator.

@typespec/openapi Breaking Changes

  • Changed namespace from OpenAPI to TypeSpec.OpenAPI.