1.0.0
TypeSpec 1.0 Release
Section titled âTypeSpec 1.0 ReleaseâToday, weâre thrilled to announce the general availability of TypeSpec 1.0! This milestone marks the transition of TypeSpecâs core components from release candidate to stable release status. TypeSpec is a Microsoft-built, community-supported project that makes API-first development truly practical by empowering you to define your APIs in a concise, human-readable format and generate all the artifacts you needâfrom OpenAPI specifications to client libraries and server code scaffoldingâfrom a single source of truth.
Breaking Changes
Section titled âBreaking Changesâ@typespec/http
Section titled â@typespec/httpâ-
#7230 Changed
@patchso that it does not apply the âimplicit optionalityâ transform by default anymore.@patch op update(@body pet: Pet): void;To use JSON Merge-Patch to update resources, replace the body property with an instance of
MergePatchUpdateas follows:@patch op update(@body pet: MergePatchUpdate<Pet>): void;Or, keep the old behavior by explicitly enabling
implicitOptionalityin the@patchoptions:@patch(#{ implicitOptionality: true }) op update(@body pet: Pet): void;
Features
Section titled âFeaturesâ@typespec/compiler
Section titled â@typespec/compilerâ-
#7199 Add âcapitalizeâ string helper to compiler
-
#7180 Add support for formatting
tspconfig.yamlwithtsp format -
#7180
tsp formatonly formats files it knows about and ignores other. Allowing a more generic glob patterntsp format .ortsp format "**/*" -
#5674 [LSP] Update imports when renaming typespec files
-
#7125 Adds typekits for getting intrinsic types via
$.intrinsic.<type> -
#7204 Update typekits
is*methods to acceptEntityinstead of justTypeorValue -
#7108 Adds support for nesting typekits
-
#7202 Replaces
$.model.getSpreadTypewith$.model.getIndexTypeto better reflect what it actually being returned.getSpreadTypedid not actually return a list of spread types, but the modelâs indexer type instead. -
#7090 Adds TypeKit support for type.inNamespace to check namespace membership
-
#7167 Adds
$.value.resolveand$.type.resolvetypekits, and updated$.resolveto return values or types, instead of just types -
#7106 Adds
$.type.isAssignableTo,$.value.isAssignableToand$.entity.isAssignableTotypekits. Also registers$.resolvetypekit -
#7193 Typekits have been moved out of experimental and can now be accessed via the
@typespec/compiler/typekitsubmodule. This also removed the$.type.getDiscriminatortypekit in favor of the$.model.getDiscriminatedUnionand$.union.getDiscriminatedUniontypkits.import { $ } from "@typespec/compiler/experimental/typekit";import { $ } from "@typespec/compiler/typekit"; -
#7105 Add typekit support for creating a union from an array of children
-
#7207 Exposed experimental function
isMutableTypeasunsafe_isMutableType. -
#7200 Added an optional
nameTemplateargument to@withVisibilityFilter, allowing the visibility filters to rename models as they are transformed. This template is applied by default in theCreate,Read,Update,Delete, andQueryvisibility transform templates. This allows for more flexible renaming than simply using the@friendlyNamedecorator, as it will change the primary name of the transformed type, reducing the incidence of naming conflicts.Cached the result of applying visibility filters to types. If the same visibility filter is applied to the same type with the same configuration, the model instance produced by the visibility filter will be object-identical. This should reduce the incidence of multiple models that are structurally equivalent in visibility filters and conflicts over the name of models.
@typespec/http
Section titled â@typespec/httpâ- #7207 Implemented JSON Merge-Patch wrappers. This allows converting a type to a JSON Merge-Patch compatible update record using the
MergePatchUpdateandMergePatchCreateOrUpdatetemplates.
@typespec/openapi3
Section titled â@typespec/openapi3â- #7199 Add âcapitalizeâ string helper to compiler
typespec-vscode
Section titled âtypespec-vscodeâ- #7042 send compile startTime and endTime telemetry
Bug Fixes
Section titled âBug Fixesâ@typespec/compiler
Section titled â@typespec/compilerâ-
#7183 Fix decorators on model properties getting wrongly called when checking the template declaration in the following cases
- inside a union expression
- under an non templated operation under a templated interface
-
#6938 Fixes template argument resolution when a default template parameter value is resolved by a parent container (e.g. interface) For example:
interface Resource<T> {read<U = T>(): U;}model Foo {type: "foo";}alias FooResource = Resource<Foo>;op readFoo is FooResource.read;The
returnTypeforreadFoowould be modelFoo. Previously thereturnTyperesolved to aTemplateParameter. -
#7153 Fixes handling of nested templates in getPlausibleName
-
#6883 Realm handle multiple instance of compiler loaded at once
-
#7222 Remove
versionproperty onServiceOptionspassed to@servicedecorator. That handling of that option was removed in1.0.0-rc.0where it was previously deprecated. If wanting to specify version in an OpenAPI document use the@OpenAPI.infodecorator from the@typespec/openapilibrary -
#7155 Mark
TemplateParametertype as an experimental type -
#7106 Removes
program.checker.isTypeAssignableTo. Use one of the following typekits instead:$(program).type.isAssignableTo$(program).value.isAssignableTo$(program).entity.isAssignableTo
-
#7207 Weakened rules around
@mediaTypeHintdecorator, allowing media type hints with suffixes like âapplication/merge-patch+jsonâ. -
#7200 Fixed an error in Model visibility filtering where the indexer of a model was ignored. This prevented the value of Array/Record instances from being transformed correctly, as they now should be.
@typespec/http
Section titled â@typespec/httpâ- #7168 Replace optional param validation requiring use with path expansion and replace with a warning when the resulting url might have a double
/