0.5.0
brantburnett
released this
10 Sep 21:07
·
17 commits
to main
since this release
Major New Features
- When using
Yardarm.SystemTextJson
serialization and deserialization now uses aJsonSerializerContext
by default for faster startup and serialization - When using compatible extensions, including
Yardarm.SystemTextJson
andYardarm.MicrosoftExtensionsHttp
, the generated SDK is trimming and NativeAOT compatible. This should greatly improve compatibility with Blazor WebAssembly. - Binary content types on responses are now exposed as a
Stream
fromGetBodyAsync
for easy reading without drilling intoMessage.Content
. - Large response bodies, such as binary
Stream
responses, may now be streamed by settingEnableResponseStreaming
totrue
on the request. Note: Be sure to dispose of the response after reading the stream. - Simple
object
schemas that only haveadditionalProperties
now generate asDictionary<string, T>
models rather than a complex object with anAdditionalProperties
property. - Support for shared parameters defined on the path rather than the operation
- Route parameters not explicitly defined in the
parameters
collection havestring
properties generated automatically - Operations without
operationId
defined are now skipped by default rather than causing an error - Extensions may apply a custom
IOperationNameProvider
to provide custom naming rules for operations - Support for API key authentication on query strings
- Support for
components/requestBodies
shared request body definitions
Breaking changes since 0.4
- The
LiteralSerializer
, which is used fortext/plain
content, path parameters, query string parameters, and header parameters no longer usesTypeDescriptor.GetConverter
. This allows compatibility with trimming and NativeAOT, but at the expense of compatibility with any type. It now explicitly handlesDateTime
,DateTimeOffset
,TimeSpan
,Guid
,Uri
,String
, all common numeric types, and enumerations for deserialization. For serialization, it will also handle any type that implementsIFormattable
. Other types will now fail. - Schemas are no longer generated using the
dynamic
keyword, all such cases now useobject
. ITypeSerializer
now supports aCancellationToken
during deserialization. This may cause extensions to fail if they create customITypeSerializer
implementations for legacy runtimes that don't support DIMs. A DIM is used to increase compatibility on .NET 6 and later.- The generated GetBodyAsync method on operation responses now accepts an optional
CancellationToken
parameter. This is a binary-level, though not source-level, breaking change in the generated SDKs when upgrading from 0.4 to 0.5. - Consumers of generated SDKs may experience a source and binary breaking change upon upgrade if there are any schemas with only
additionalProperties
that are now represented as plain dictionaries.
What's Changed
- Update GHA versions by @brantburnett in #238
- Allow undefined route parameters by @brantburnett in #240
- Generate classes for common request bodies by @brantburnett in #241
- Skip operations without ids by @brantburnett in #242
- Generate correct code for parameter components by @brantburnett in #243
- Update to System.Text.Json 8.0.4 by @brantburnett in #244
- Add support for query string based API keys by @brantburnett in #245
- Generate properties for parameters included on path items by @brantburnett in #246
Full Changelog: release/0.5.0-beta0002...release/0.5.0