October 2022
This release contains breaking changes:
- TypeSpec: Cannot- extendsor- isa model expression via alias
- Api: Removed- createProgramand changed- compileparameter order
- TypeSpecDeprecation- @servicedecorator replacing- @serviceTitleand- @serviceVersion
- TypeSpec- Api: Move- @discriminatorto compiler
[TypeSpec] Cannot extends or is a model expression via alias PR 1004
Using model expression for is or extends directly was already forbidden.
model IsModelExpr is {bar: string} {}
model ExtendsModelExpr extends {bar: string} {}The following workaround was however tolerated. This PR remove this functionality.
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
// BeforecreateProgram(host, "main.tsp);
// Aftercompile(host, "main.tsp");compile api was changed to match the same order as old createProggram
// Beforecompile("main.tsp", host);
// Aftercompile(host, "main.tsp");[TypeSpec] Deprecation: @service decorator replacing @serviceTitle and @serviceVersion
- @serviceTitlehas been deprecated
- @serviceVersionhas been deprecated
// 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
@servicenamespace 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
using Rest;
@disriminator("kind")model Pet {}Before
@TypeSpec.Rest.disriminator("kind")model Pet {}After
@disriminator("kind")model Pet {}Change to api
the getDiscriminator accessor has also been removed into the compiler.
Before
import { getDiscriminator } from "@typespec/rest";After
import { getDiscriminator } from "@typespec/compiler";