3.0.0
Breaking changes
-
Changed the type
XmlNode
by removing theRawText
andEncodedText
union case and replaced both by a singleText
union case. The HTML encoding (or not) is being done now when calling one of the two helper functionsrawText
andencodedText
.- This change - even though theoretically a breaking change - should not affect the vast majority of Giraffe users unless you were constructing your own
XmlNode
elements which were of typeRawText
orEncodedText
(which is extremely unlikely given that there's not much room for more nodes of these two types).
- This change - even though theoretically a breaking change - should not affect the vast majority of Giraffe users unless you were constructing your own
-
Removed the
task {}
override in Giraffe which was forcing theFSharp.Control.Tasks.V2.ContextInsensitive
version of the Task CE. This change has no effect on the behaviour oftask
computation expressions in Giraffe. In the context of an ASP.NET Core web application there is not difference betweenContextSensitive
andContextInsensitive
which is why the override has been removed. The only breaking change which could affect an existing Giraffe web application is that in some places you will need to explicitlyopen FSharp.Control.Tasks.V2.ContextInsensitive
where before it might have been sufficient to onlyopen Giraffe
. -
Changed the members of the
IJsonSerializer
interface to accommodate new (de-)serialize methods for chunked encoding transfer.The new interface is the following:
type IJsonSerializer = abstract member SerializeToString<'T> : 'T -> string abstract member SerializeToBytes<'T> : 'T -> byte array abstract member SerializeToStreamAsync<'T> : 'T -> Stream -> Task abstract member Deserialize<'T> : string -> 'T abstract member Deserialize<'T> : byte[] -> 'T abstract member DeserializeAsync<'T> : Stream -> Task<'T>
Improvements
- Significant performance improvements in the
GiraffeViewEngine
by changing the underlying composition of views from simple string concatenation to using aStringBuilder
object.
New features
- Support for short GUIDs and short IDs (aka YouTube IDs) in route arguments and query string parameters.
- Enabled SourceLink support for Giraffe source code (thanks Cameron Taggart)! For more information check out Adding SourceLink to your .NET Core Library.
- Added a new JSON serializer called
Utf8JsonSerializer
. This type uses the Utf8 JSON serializer library, which is currently the fastest JSON serializer for .NET.NewtonsoftJsonSerializer
is still the default JSON serializer in Giraffe (for stability and backwards compatibility), butUtf8JsonSerializer
can be swapped in via ASP.NET Core's dependency injection API. The newUtf8JsonnSerializer
is significantly faster (especially when sending chunked responses) thanNewtonsoftJsonSerializer
. - Added a new
HttpContext
extension method for chunked JSON transfers:WriteJsonChunkedAsync<'T> (dataObj : 'T)
. This newHttpContext
method can write content directly to the HTTP response stream without buffering into a byte array first (see Writing JSON). - Added a new
jsonChunked
http handler. This handler is the equivalent http handler version of theWriteJsonChunkedAsync
extension method. - Added first class support for ASP.NET Core's response caching feature.
Special thanks
Special thanks to Dmitry Kushnir for doing the bulk work of all the perf improvements in this release as well as adding Giraffe to the TechEmpower Webframework Benchmarks!