May 2023
New Features
Section titled âNew Featuresâ@typespec/compiler features
Section titled â@typespec/compiler featuresâ- Add
@encodedecorator, with new formats for date and duration encoding support"rfc3339","rfc7231'forutcDateTime,offsetDateTimetypes"unixTimestamp"support forutcDateTimetype"iso8601"support fordurationtypes"base64","base64url"support forbytestypes
- Allow default values for required model properties and parameters
sourceModelproperty added toModeltypessourceOperationproperty added toOperationtypesModelandScalartypes added toTypeSpec.Reflectionnamespace
@typespec/http features
Section titled â@typespec/http featuresâ- add
@sharedRoutedecorator - allow union types within a response status code
@typespec/openapi3 features
Section titled â@typespec/openapi3 featuresâ- Enhanced support for shared routes
- Support for union types within a response status code
Bug Fixes
Section titled âBug Fixesâ- General fixes to generated reference documentation for all modules
@typespec/compiler fixes
Section titled â@typespec/compiler fixesâ- Fix: compiler mismatch error recommendation
- Fix: Interface with templated operation causing crash if defined after use
- Fix: Issue with templated operations in templated interface would get cached only by keying on the operation template args.
- Fix:
missing-indexdiagnostic showing at the wrong location - Fix:
--emitpointing to emitter js entrypoint resolve correct options - Fix:
scalartemplate parameter name conflict with each other
@typespec/migrate fixes
Section titled â@typespec/migrate fixesâ- Fix: incorrect resolution of tsp version
- Fix: always loading current version of compiler
@typespec/openapi3 fixes
Section titled â@typespec/openapi3 fixesâ- Fix openapi3 emitter to mark request body required
- Fix issue where shared request bodies did not emit correctly.
@typespec/rest
Section titled â@typespec/restâ- Add validation to ensure that @action or @collectionAction operations have a specified name when used with
@sharedRoute
@typespec/versioning
Section titled â@typespec/versioningâ- Fix: Crash during validation when using certain templated models from versioned library
- Added validation preventing version enums from having duplicate values.
- Fix issue where âisâ dependencies were not detected.
- Raise error if versioned spec specifies a single service version.
Breaking Changes
Section titled âBreaking Changesâ@typespec/compiler: isTemplateDeclaration will only return true for the original declaration and not partially instantiated templates
Section titled â@typespec/compiler: isTemplateDeclaration will only return true for the original declaration and not partially instantiated templatesâIf library or emitter code needs to detect a partially instantiated template, the code will need to check isTemplateInstance and isTemplateDeclaration properties are false.
Deprecations
Section titled âDeprecationsâ@typespec/compiler: Use @encode instead of @format for encoding scalars and properties of type bytes
Section titled â@typespec/compiler: Use @encode instead of @format for encoding scalars and properties of type bytesâThe new @encode decorator should be used whenever the serialized type on the wire differs from the analogous TypeSpec type
Old deprecated usage of @format decorator
Section titled âOld deprecated usage of @format decoratorâmodel Foo { @format("base64url") bar: bytes;}New usage of @encode decorator
Section titled âNew usage of @encode decoratorâmodel Foo { @encode("base64url") bar: bytes;}http: Use @sharedRoute instead of the shared property of @route options
Section titled âhttp: Use @sharedRoute instead of the shared property of @route optionsâThe new @sharedRoute decorator replaces @route options for identifying operations that share a route
Old deprecated usage of @route decorator shared option
Section titled âOld deprecated usage of @route decorator shared optionâ@route( "/doStuff", { shared: true, })op doIntStuff(input: int32): int32;
@route( "/doStuff", { shared: true, })op doStringStuff(input: string): string;New usage of @sharedRoute decorator
Section titled âNew usage of @sharedRoute decoratorâ@sharedRoute@route("/doStuff")op doIntStuff(input: int32): int32;
@sharedRoute@route("/doStuff")op doStringStuff(input: string): string;