Releases: microsoft/typespec
[email protected]
@typespec/compiler
Bug Fixes
- #3881 Fixes a bug where ending a non-terminal line in a multi-line comment with a backslash caused the next star to show up in the parsed doc string.
- #4050 Allow using compact namespace form
Foo.Bar
when inside another namespacenamespace MyOrg.MyProject { namespace MyModule.MySubmodule { // <-- this used to emit an error // ... } }
- #3898 Fix decimal numeric with leading zeros
- #4046 Fix type comparison of literal and scalar when in projection context
- #4022
tsp compile --watch
will not stop when a crash happens during compilation - #3933 Add
const
template parameter to get the precise lib type
Bump dependencies
- #3948 Update dependencies
Features
-
#3906 Support completion for template parameter extending model or object value
Example
model User<T extends {name: string, age: int16}> { } alias user = User< {┆ | [age] | [name]
-
#4020 Add support for encoding numeric types as string
-
#4023 Warn when using
\
in config file field that expect a path. -
#3932 Add
ArrayEncoding
enum to define simple serialization of arrays
Breaking Changes
-
#4050 Fix issue where naming a namespace with the same name as the blockless namespace would merge with it instead of creating a subnamespace like any other name would.
namespace MyOrg.MyProject; namespace MyOrg.MyProject.MyArea { model A {} } namespace MyArea2 { model B {} }
Previously model
A
would end-up in namespaceMyOrg.MyProject.MyArea
and modelB
inMyOrg.MyProject.MyArea2
. With this change modelA
will now be inMyOrg.MyProject.MyOrg.MyProject.MyArea
. To achieve the previous behavior the above code should be written as:namespace MyOrg.MyProject; namespace MyArea { model A {} } namespace MyArea2 { model B {} }
@typespec/http
Bug Fixes
- #3909 Fix
HttpPart
not respecting explicit part name by always using the property name - #3933 Fix some diagnostic not showing the right message
Bump dependencies
- #3948 Update dependencies
Features
-
#4046 API: Expose
properties: HttpProperty[]
on operation parameter and response which reference all the properties of interest(Body, statusCode, contentType, implicitBodyProperty, etc.) -
#3932
@route
can now take a uri template as defined by RFC-6570@route("files{+path}") download(path: string): void;
Deprecations
-
#3932 API deprecation:
HttpOperation#pathSegments
is deprecated. UseHttpOperation#uriTemplate
instead. -
#3932 Deprecated
@query({format: })
option. Use@query(#{explode: true})
instead ofform
ormulti
format. Previouslycsv
/simple
is the default now.
Decorator is also expecting an object value now instead of a model. A deprecation warning with a codefix will help migrating.- @query({format: "form"}) select: string[]; + @query(#{explode: true}) select: string[];
@typespec/versioning
Bug Fixes
- #3911 Allow spreading a model that has props added in previous version
- #3951 Fixes issue where spreading a versioned model as a parameter to an incompatible versioned operation would cause the compiler to crash.
Bump dependencies
- #3948 Update dependencies
@typespec/rest
Bump dependencies
- #3948 Update dependencies
Features
- #3932 Add support for URI templates in routes
@typespec/openapi
Bump dependencies
- #3948 Update dependencies
@typespec/openapi3
Bug Fixes
- #4046 Fix issue where operation example would produce an empty object when
@body
/@bodyRoot
was used - #4046 Fix operation response body examples showing up for each response.
- #3912 Fixes bug where union documentation was being applied to each union member in emitted output.
- #3908 Fixes bug where circular references in unions caused an empty object to be emitted instead of a ref.
Bump dependencies
- #3948 Update dependencies
Features
- #3894 Add support for
@useRef
on responses - #4020 Add support for encoding numeric types as string
- #3890
@extension
used on the service namespace will set extension at the root of the document - #3932 Add support for URI templates in routes
@typespec/protobuf
Bug Fixes
- #3933 Fix some diagnostic not showing the right message
Bump dependencies
- #3948 Update dependencies
@typespec/prettier-plugin-typespec
Bump dependencies
- #3948 Update dependencies
@typespec/eslint-plugin
Bump dependencies
- #3948 Update dependencies
@typespec/html-program-viewer
Bump dependencies
- #3948 Update dependencies
@typespec/json-schema
Bump dependencies
- #3948 Update dependencies
Breaking Changes
- #3558 Updates
@extension
decorator to support TypeSpec values in addition to types.
In previous versions of the json-schema emitter, the @extension
decorator only accepted types as the value. These are emitted as JSON schemas. In order to add extensions as raw values, types had to be wrapped in the Json<>
template when being passed to the @extension
decorator.
This change allows setting TypeSpec values (introduced in TypeSpec 0.57.0) directly instead.
The following example demonstrates using values directly:
@extension("x-example", #{ foo: "bar" })
model Foo {}
This change results in scalars being treated as values instead of types. This will result in the @extension
decorator emitting raw values for scalar types instead of JSON schema. To preserve the previous behavior, use typeof
when passing in a scalar value.
The following example demonstrates how to pass a scalar value that emits a JSON schema:
@extension("x-example", "foo")
model Foo {}
To preserve this same behavior, the above example can be updated to the following:
@extension("x-example", typeof "foo")
model Foo {}
@typespec/internal-build-utils
Bump dependencies
- #3948 Update dependencies
typespec-vs
Bug Fixes
- #4115 Fixed a router bug where paths would sometimes fail to match after a parameter was bound.
typespec-vscode
Bump dependencies
- #3948 Update dependencies
@typespec/library-linter
Bump dependencies
- #3948 Update dependencies
[email protected]
Bump dependencies
- #3948 Update dependencies
@typespec/[email protected]
@typespec/[email protected]
Bump dependencies
- #3948 Update dependencies
@typespec/[email protected]
Bump dependencies
- #3948 Update dependencies
@typespec/[email protected]
Bug Fixes
- #3933 Fix some diagnostic not showing the right message
- #4101 Fixed enum representation, an edge case with optional parameter joining, and a couple of type errors around query/header params.
- #4115 Fixed a router bug where paths would sometimes fail to match after a parameter was bound.
Bump dependencies
- #3948 Update dependencies
@typespec/[email protected]
No changes, version bump only.
@typespec/[email protected]
CSharp Service Emitter (#2904) Fixes #3141 --------- Co-authored-by: Timothee Guerin <[email protected]> Co-authored-by: Timothee Guerin <[email protected]>
[email protected]
@typespec/compiler
Bug Fixes
- #3623 Fix crash of language server on firefox
- #3516 Deprecate getAssetEmitter and recommend calling
createAssetEmitter
directly - #3767 Fix semantic highlighting of using of single namespace
- #3824 Do not cast model expression to object value if the constraint is allowing the type
- #3577 Fix formatting of object and array literal in decorator to hug parenthesis
- #3823 Fix formatting of scalar constructor called with no args
- #3743 Fix 'typespec vs install' command on windows
- #3605 Fix templates initialized on node 22
Bump dependencies
- #3718 Dependency updates July 2024
Features
-
#3699 Moved compiler dependencies to peer and dev for scaffolded projects.
-
#3572 Add new
@example
and@opExample
decorator to provide examples on types and operations.@example(#{ id: "some", date: utcDateTime.fromISO("2020-01-01T00:00:00Z"), timeout: duration.fromISO("PT1M"), }) model Foo { id: string; date: utcDateTime; @encode("seconds", int32) timeout: duration; }
@opExample( #{ parameters: #{ pet: #{ id: "some", name: "Fluffy", dob: plainDate.fromISO("2020-01-01"), }, }, returnType: #{ id: "some", name: "Fluffy", dob: plainDate.fromISO("2020-01-01"), }, }, #{ title: "First", description: "Show creating a pet" } ) op createPet(pet: Pet): Pet;
-
#3751 Adds option to
tsp init
to generate .gitignore file
Breaking Changes
-
#3793 Do not carry over
@friendlyName
withmodel is
orop is
@friendlyName("Abc{T}", T) model Foo<T> {} model Bar is Foo<string>; // This can be changed to model Abcstring is Foo<string>;
-
#3659 Disallows overriding a required inherited property with an optional property.
In previous versions of TypeSpec, it was possible to override a required property with an optional property. This is no longer allowed. This change may result in errors in your code if you were relying on this bug, but specifications that used this behavior are likely to have been exposed to errors resulting from incoherent type checking behavior.
The following example demonstrates the behavior that is no longer allowed:
model Base {
example: string;
}
model Child extends Base {
example?: string;
}
In this example, the Child
model overrides the example
property from the Base
model with an optional property. This is no longer allowed.
@typespec/http
Bump dependencies
- #3718 Dependency updates July 2024
Features
- #3717 Allow overriding base operation verb
- #3676 Expose
getHttpPart
and types functions - #3732 Expose
model
property onHttpAuth
to retrieve original type used to define security scheme
Breaking Changes
-
#3737 Keep trailing slash when building http routes, this is breaking if you used to have
@route()
ending with/
.TypeSpec Before After @route("users/")
users
users/
@route("users")
users
users
on interface @route("users/")
and on op@route("addresses/")
users/addresses
users/addresses/
on interface @route("users/")
and on op@route("addresses")
users/addresses
users/addresses
@typespec/versioning
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/rest
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/openapi
Bump dependencies
- #3718 Dependency updates July 2024
Features
- #3626 Adds public function for setting info object
@typespec/openapi3
Bug Fixes
- #3516 Fix issue that could result in invalid document generation when running
tsp compile
from another directory - #3794 Updates tsp-openapi3 to always emit main.tsp when formatting encounters an error.
- #3839 Updates tsp-openapi3 doc line wrapping to only automatically create newlines when they are present in the original documentation.
Bump dependencies
- #3718 Dependency updates July 2024
Features
- #3572 Add support for new
@example
and@opExample
decorator - #3663 Adds support for converting OpenAPI3 specs to TypeSpec via the new tsp-openapi3 CLI included in the
@typespec/openapi3
package. - #3732 Apply openapi3 extension on Security schemes
- #3844 Updates tsp-openapi3 to escape identifiers that would otherwise be invalid, and automatically resolve namespaces for schemas with dots in their names.
@typespec/protobuf
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/prettier-plugin-typespec
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/eslint-plugin
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/html-program-viewer
Bug Fixes
- #3585 Fix crash in program viewer when trying to display new value type
Bump dependencies
- #3718 Dependency updates July 2024
Features
- #3713 Complete new dynamic UI to navigate the TypeSpec type graph
@typespec/json-schema
Bug Fixes
- #3516 Fix issue that could result in invalid document generation when running
tsp compile
from another directory
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/internal-build-utils
Bump dependencies
- #3718 Dependency updates July 2024
typespec-vs
No changes, version bump only.
typespec-vscode
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/library-linter
Bump dependencies
- #3718 Dependency updates July 2024
[email protected]
Bump dependencies
- #3718 Dependency updates July 2024