July 2023
New Features
Section titled âNew Featuresâ@typespec/compiler and core language
Section titled â@typespec/compiler and core languageâ- New built-in linter system. Typespec libraries are able to define linting rules which can be configured in
tspconfig.yaml. See documentation for configuring a linter and writing a linter - Allow decorators, directives and doc comments to be specified in any order
- Format doc comments above decorators and directives
- Improve formatting for properties with comments and decorators
- Support for new Unicode 15.0 identifier characters
Emitter framework
Section titled âEmitter frameworkâ- Add
writeOutputto TypeEmitter for additional customization in writing generated files - Add
metaproperty to source files and declarations to store arbitrary metadata - Add support for emitting enum member references
- Add new
TypeEmittermethods for scalar instantiation
@typespec/http library
Section titled â@typespec/http libraryâ- Add documentation on automatic header name resolution from property name for
@headerdecorator
@typespec/json-schema emitter
Section titled â@typespec/json-schema emitterâ- Support
@extensionfor adding arbitrary vendor extensions into the output - Add support for
Record<T> - Support templates instantiated with intrinsic types and type expressions
- Export emitter and related types from the npm package
- By default, types that are not marked with
@jsonSchemaor are within a namespace with@jsonSchemaare bundled into the schemas that reference them. Set theemitAllRefsoption to true to get the previous behavior of emitting all types referenced as JSON Schema
@typespec/openapi3 emitter
Section titled â@typespec/openapi3 emitterâ- Omit
x-typespec-nameextension by default from openapi3 output. A new configuration and command line optioninclude-x-typespec-name: \"inline-only\" | \"never\"has been added to get previous behavior
@typespec/rest library
Section titled â@typespec/rest libraryâ- Add
isListOperationfunction migrated from@typespec/compiler
Bug Fixes
Section titled âBug Fixesâ@typespec/compiler and core language bug fixes
Section titled â@typespec/compiler and core language bug fixesâ- Add support for
UTF-8 with bomfor other files loaded by TypeSpec compiler..tspfiles already had support, this make it more available for any library/emitter using the compiler api to load a file. - Fix signature help after comment with no closing parenthesis or angle bracket
- Doc comment
/** */should override base type doc inmodel isorop is - Formatter incorrectly formatting
::to. - Fix formatting issue with comment between decorator and scalar or interface
- Fix stack overflow when a circular reference with
op isexists inside an interface. - Clean up handling of non-standard entrypoints in language server
- Fix stack overflow when referencing decorator target in checker and projections
@typespec/openapi3 emitter bug fixes
Section titled â@typespec/openapi3 emitter bug fixesâ- OpenAPI emitters: treat union namespaces like namespaces for other types
Emitter framework bug fixes
Section titled âEmitter framework bug fixesâ- Fix that some context methods were not being passed the expected parameters
- Fix that context was set incorrectly for some
TypeEmittermethods, and add missing context methods for model properties, enum members, and union variants
@typespec/json-schema emitter bug fixes
Section titled â@typespec/json-schema emitter bug fixesâ- Fix a bug that could result in a schema being bundled more than once
Breaking Changes
Section titled âBreaking ChangesâFor Specification Authors
Section titled âFor Specification Authorsâ- Update tsp init template schema for future extensibility. Older tsp version will fail validation when trying to initialize a project with a new template definition.
- Json Schema Emitter: the namespace has been corrected to TypeSpec.JsonSchema. Update any using statements from
JsonSchematoTypeSpec.JsonSchema, and any references fromJsonSchema.[Type]toTypeSpec.JsonSchema.[Type].
For Emitters and Libraries
Section titled âFor Emitters and Librariesâ- Minimum version of TypeScript updated to 5.0. TypeSpec is using new features available in TypeScript 5.0 which result in a definition file not parsable by older version. Note that this only affect compiling TypeScript code and is not breaking any JS or TypeSpec code. See more information on typescript 5.0
- Emitter Framework: Add support for templates instantiated with types without declared names. In such cases,
TypeEmitterâs declarationName method may returnundefined, and so the various*Instantiationmethods might be called with an undefined name, andAssetEmitterâsemitDeclarationNamemethod might return undefined. - Make internal
@resourceTypeForKeyParamdecorator in@typespec/restlibrary private
Deprecations
Section titled âDeprecationsâ@listdecorator from TypeSpec core is deprecated. Use@listsResourcefrom@typespec/httpinsteadisListOperationfunction from TypeSpec core is deprecated. UseisListOperationfrom@typespec/httpinsteadgetListOperationTypefrom TypeSpec core is deprecated@typespec/linterPackage is deprecated in favor of built-in linter system