microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
a6b7827fcd2db3bf604d42e235216c8d5b244f13

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/release-notes/release-2022-10-12.md

123lines · modepreview

---
title: October 2022
---

# Release Notes October 2022 (2022-10-12)

This release contains **breaking changes**:

- **`TypeSpec`**: Cannot `extends` or `is` a model expression via alias
- **`Api`**: Removed `createProgram` and changed `compile` parameter order
- **`TypeSpec`** **Deprecation** `@service` decorator replacing `@serviceTitle` and `@serviceVersion`
- **`TypeSpec`** **`Api`**: Move `@discriminator` to compiler

## [TypeSpec] Cannot `extends` or `is` a model expression via alias [PR 1004](https://github.com/microsoft/typespec/pull/1004)

Using model expression for `is` or `extends` directly was already forbidden.

<!-- prettier-ignore -->
```typespec
model IsModelExpr is {bar: string} {}

model ExtendsModelExpr extends {bar: string} {}
```

The following workaround was however tolerated. This PR remove this functionality.

<!-- prettier-ignore -->
```typespec
alias ModExpr = {bar: string};
model IsModelExprWAlias is ModExpr {}

model ExtendsModelExprWAlias extends ModExpr {}
```

Use a named model instead of an alias.

## [API] Removed `createProgram` and changed `compile` parameter order

`createProgram` has been removed in favor of `compile`. The new compile has the same parameter as `createProgram`

```ts
// Before
createProgram(host, "main.tsp);

// After
compile(host, "main.tsp");
```

`compile` api was changed to match the same order as old `createProggram`

```ts
// Before
compile("main.tsp", host);

// After
compile(host, "main.tsp");
```

## [TypeSpec] Deprecation: @service decorator replacing `@serviceTitle` and `@serviceVersion`

- `@serviceTitle` has been deprecated
- `@serviceVersion` has been deprecated

```typespec
// Before
@serviceTitle("Pet Store")
@serviceVersion("v1")
namespace PetStore;

// After
@service({"Pet Store", version: "v1"})
namespace PetStore;
```

This allows to specify the service namespace without any title or version

```typespec
@service
namespace PetStore;
```

## [TypeSpec] [Api] Move `@discriminator` to compiler

The `@discriminator` has been moved to the compiler. This means that if you were using the fully qualified name to reference the decorator `@TypeSpec.Rest.disriminator` it should be changed to `@discriminator`

**No changes**

```typespec
using TypeSpec.Rest;

@disriminator("kind")
model Pet {}
```

**Before**

```typespec
@TypeSpec.Rest.disriminator("kind")
model Pet {}
```

**After**

```typespec
@disriminator("kind")
model Pet {}
```

### Change to api

the `getDiscriminator` accessor has also been removed into the compiler.

Before

```ts
import { getDiscriminator } from "@typespec/rest";
```

After

```ts
import { getDiscriminator } from "@typespec/compiler";
```