Releases: microsoft/typespec
@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
@typespec/[email protected]
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/[email protected]
@typespec/[email protected]
No changes, version bump only.
@typespec/[email protected]
Bug Fixes
- #3875 Fix issues with examples not working with
Array
,Record
,Union
andunknown
types
@typespec/[email protected]
Bump dependencies
- #3718 Dependency updates July 2024
@typespec/[email protected]
[http-server-javascript] Merge JavaScript Server Generator to Main (#…
[email protected]
@typespec/compiler
Bug Fixes
- #3399 Preserve leading whitespace in fenced blocks in doc comments
- #3566 [API] Do not run decorators on cloned type if the original type wasn't finished
- #3522 Fix EINVAL error when running
tsp code install
- #3371 Numeric not handling trailing zeros and causing freeze(e.g.
const a = 100.0
) - #3451 Emitter framework: fix losing context when referencing circular types
- #3517 Fix application of
@param
doc tag on operation create withop is
to override upstream doc - #3488 Add
PickProperties
type to dynamically select a subset of a model
Bump dependencies
- #3401 Update dependencies - May 2024
Features
-
#3280 Support completion for Model with extended properties
Example
model Device { name: string; description: string; } model Phone extends Device { ┆ } | [name] | [description]
-
#3280 Support completion for object values and model expression properties.
Example
model User { name: string; age: int32; address: string; } const user: User = #{name: "Bob", ┆} | [age] | [address]
-
#3375 Allow
@
to be escaped in doc comment with\
Object and array values
@dummy(#{
name: "John",
age: 48,
address: #{ city: "London" }
aliases: #["Bob", "Frank"]
})
Scalar constructors
scalar utcDateTime {
init fromISO(value: string);
}
model DateRange {
minDate: utcDateTime = utcDateTime.fromISO("2024-02-15T18:36:03Z");
}
-
#3527 Add support for
@prop
doc comment tag to describe model properties -
#3422 Formatter: Indent or dedent multiline strings to the current indentation
-
#3460 Hide deprecated items from completion list
-
#3443 Support completion for keyword 'extends' and 'is'
Example
model Dog ┆ {} | [extends] | [is] scalar Addresss ┆ | [extends] op jump ┆ | [is] interface ResourceA ┆ {} | [extends] model Cat<T ┆> {} | [extends]
-
#3462 Linter
all
rulesets is automatically created if not explicitly provided -
#3533 More logs and traces are added for diagnostic and troubleshooting in TypeSpec language server
Deprecations
- #3022 Using a tuple type as a value is deprecated. Tuple types in contexts where values are expected must be updated to be array values instead. A codefix is provided to automatically convert tuple types into array values.
model Test {
// Deprecated
values: string[] = ["a", "b", "c"];
// Correct
values: string[] = #["a", "b", "c"];
- #3022 Using a model type as a value is deprecated. Model types in contexts where values are expected must be updated to be object values instead. A codefix is provided to automatically convert model types into object values.
model Test {
// Deprecated
user: {name: string} = {name: "System"};
// Correct
user: {name: string} = #{name: "System"};
- #3022 Decorator API: Legacy marshalling logic
With the introduction of values, the decorator marshalling behavior has changed in some cases. This behavior is opt-in by setting the valueMarshalling
package flag to "new"
, but will be the default behavior in future versions. It is strongly recommended to adopt this new behavior as soon as possible.
Example:
extern dec multipleOf(target: numeric | Reflection.ModelProperty, value: valueof numeric);
Will now emit a deprecated warning because value
is of type valueof string
which would marshall to Numeric
under the new logic but as number
previously.
To opt-in you can add the following to your library js/ts files.
export const $flags = definePackageFlags({
decoratorArgMarshalling: "new",
});
@typespec/http
Bug Fixes
- #3022 Update Flow Template to make use of the new array values
Bump dependencies
- #3401 Update dependencies - May 2024
Features
-
#3342 Add new multipart handling. Using
@multipartBody
withHttpPart<Type, Options>
. See multipart docs for more information.op upload(@header contentType: "multipart/mixed", @multipartBody body: { name: HttpPart<string>; avatar: HttpPart<bytes>[]; }): void;
-
#3462 Use new compiler automatic
all
ruleset instead of explicitly provided one
@typespec/versioning
Bug Fixes
- #3292 Add
@madeRequired
decorator - #3022 Update to support new value types
- #3409 Using
@removed
on member types and@added
on containing type could result in errors - #3255 If a property were marked with @added on a later version, the logic that said it was originally added on the first version was erroneously removed, resulting in incorrect projections.
Bump dependencies
- #3401 Update dependencies - May 2024
@typespec/rest
Bug Fixes
- #3022 Update types to support new values in TypeSpec
Bump dependencies
- #3401 Update dependencies - May 2024
@typespec/openapi
Bump dependencies
- #3401 Update dependencies - May 2024
@typespec/openapi3
Bug Fixes
- #3342 Add support for new multipart constructs in http library
- #3574 Emit diagnostic when an invalid type is used as a property instead of crashing.
Bump dependencies
- #3401 Update dependencies - May 2024
Features
- #3022 Add support for new object and array values as default values (e.g.
decimals: decimal[] = #[123, 456.7];
)
@typespec/protobuf
Bug Fixes
- #3022 Update to support new value types
- #3561 Corrected cross-package reference behavior in some buggy cases.
Bump dependencies
- #3401 Update dependencies - May 2024
@typespec/prettier-plugin-typespec
Bump dependencies
- #3401 Update dependencies - May 2024
@typespec/eslint-plugin
Bump dependencies
- #3401 Update dependencies - May 2024
@typespec/html-program-viewer
Bump dependencies
- #3401 Update dependencies - May 2024
Features
- #3022 Add support for values
@typespec/json-schema
Bug Fixes
- #3398 Fix decorators application for union variants
- #3022 Update to support new value types
- #3430 The emitted JSON Schema now doesn't make root schemas for TypeSpec types which do not have the @jsonschema decorator or are contained in a namespace with that decorator. Instead, such schemas are put into the $defs of any root schema which references them, and are referenced using JSON Pointers.
Bump dependencies
- #3401 Update dependencies - May 2024
Features
@typespec/internal-build-utils
Bump dependencies
- #3401 Update dependencies - May 2024
typespec-vs
Features
- #3461 Support Arm64
typespec-vscode
Bump dependencies
- #3401 Update dependencies - May 2024
Features
- #3533 Enhance logging and trace
- Support "Developer: Set Log Level..." command to filter logs in TypeSpec output channel
- Add "typespecLanguageServer.trace.server" config for whether and how to send th...