---
title: May 2023
releaseDate: 2023-05-10
---

:::caution
This release contains **breaking changes**
:::

## New Features

### @typespec/compiler features

- Add `@encode` decorator, with new formats for date and duration encoding support
  - `"rfc3339"`, `"rfc7231'` for `utcDateTime`, `offsetDateTime` types
  - `"unixTimestamp"` support for `utcDateTime` type
  - `"iso8601"` support for `duration` types
  - `"base64"`, `"base64url"` support for `bytes` types
- Allow default values for required model properties and parameters
- `sourceModel` property added to `Model` types
- `sourceOperation` property added to `Operation` types
- `Model` and `Scalar` types added to `TypeSpec.Reflection` namespace

### @typespec/http features

- add `@sharedRoute` decorator
- allow union types within a response status code

### @typespec/openapi3 features

- Enhanced support for shared routes
- Support for union types within a response status code

## Bug Fixes

- General fixes to generated reference documentation for all modules

### @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-index` diagnostic showing at the wrong location
- Fix: `--emit` pointing to emitter js entrypoint resolve correct options
- Fix: `scalar` template parameter name conflict with each other

### @typespec/migrate fixes

- Fix: incorrect resolution of tsp version
- Fix: always loading current version of compiler

### @typespec/openapi3 fixes

- Fix openapi3 emitter to mark request body required
- Fix issue where shared request bodies did not emit correctly.

### @typespec/rest

- Add validation to ensure that @action or @collectionAction operations have a specified name when used with `@sharedRoute`

### @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

### `@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

### `@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

```typespec
model Foo {
  @format("base64url")
  bar: bytes;
}
```

#### New usage of `@encode` decorator

```typespec
model Foo {
  @encode("base64url")
  bar: bytes;
}
```

### 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

```typespec
@route(
  "/doStuff",
  {
    shared: true,
  }
)
op doIntStuff(input: int32): int32;

@route(
  "/doStuff",
  {
    shared: true,
  }
)
op doStringStuff(input: string): string;
```

#### New usage of `@sharedRoute` decorator

```typespec
@sharedRoute
@route("/doStuff")
op doIntStuff(input: int32): int32;

@sharedRoute
@route("/doStuff")
op doStringStuff(input: string): string;
```
