FSharp.HotChocolate
0.1.2
See the version list below for details.
dotnet add package FSharp.HotChocolate --version 0.1.2
NuGet\Install-Package FSharp.HotChocolate -Version 0.1.2
<PackageReference Include="FSharp.HotChocolate" Version="0.1.2" />
paket add FSharp.HotChocolate --version 0.1.2
#r "nuget: FSharp.HotChocolate, 0.1.2"
// Install FSharp.HotChocolate as a Cake Addin #addin nuget:?package=FSharp.HotChocolate&version=0.1.2 // Install FSharp.HotChocolate as a Cake Tool #tool nuget:?package=FSharp.HotChocolate&version=0.1.2
FSharp.HotChocolate
Support for F# types and nullability in HotChocolate.
Quick start
- Remove any existing calls to
AddFSharpTypeConverters
orAddTypeConverter<OptionTypeConverter>
. - Call
AddFSharpSupport
:.AddGraphQLServer().AddFSharpSupport()
Features
Idiomatic F# nullability through Option<_>
All fields defined in F# (including HotChocolate type extensions for types not defined in F#) will have idiomatic F#
nullability applied. This means that everything except Option
-wrapped values will be non-nullable (!
) in the GraphQL
schema. Any usages of [<GraphQLNonNullType>]
, or NonNullType<_>
in [<GraphQLType>]
, will be ignored.
Opting out of F# nullability
Due to limitations (see below) or other reasons, you may want to opt out of F# nullability for a certain scope. You can
apply the SkipFSharpNullability
attribute to parameters, members, types (including HotChocolate type extensions), or
whole assemblies to disable F# nullability processing for that scope.
Limitations in F# nullability
- When using global object identification,
Option
-wrapped node resolvers are not supported (#5). - When using global object identification,
Option
-wrappedID
values inside lists are not supported (#6). - Support for
ValueOption<_>
is not yet added (#10). - When using
UsePaging
, the nullability of thefirst
,last
,before
, andafter
parameters is controlled by HotChocolate. These are always nullable. Therefore, if these parameters are explicitly present in your method (e.g. if doing custom pagination), make sure you wrap them inOption<_>
. The only exception is if you useRequirePagingBoundaries = true
withAllowBackwardPagination = false
; in that case, HotChocolate will effectively enforce that these (only) two parameters are non-null
on input (even though they are nullable in the schema), and it's safe to not wrap them inOption<_>
in code.
Async<_>
fields
Fields can now be Async<_>
.
The computations are automatically wired up to the RequestAborted
cancellation token. If you do not want that, please
convert the Async<_>
to Task<_>
yourself as you see fit.
Limitations in Async<_>
fields
- When using some built-in middleware such as
[<UsePaging>]
,Async<_>
is not supported for that field. (#8). - When using global object identification,
Async<_>
is not supported for node resolvers (#9).
Acknowledgements
Many thanks to @Stock44 for creating this gist that sparked this project. Without that, I'd have no idea where to even begin.
Deployment checklist
For maintainers.
- Make necessary changes to the code
- Update the changelog
- Update the version and release notes in the fsproj files
- Commit and tag the commit in the format
v/x.y.z
(this is what triggers deployment) - Push the changes and the tag to the repo. If the build succeeds, the package is automatically published to NuGet.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- FSharp.Core (>= 8.0.100)
- HotChocolate.AspNetCore (>= 14.0.0-rc.2)
- HotChocolate.Types.CursorPagination (>= 14.0.0-rc.2)
- HotChocolate.Types.FSharp (>= 14.0.0-rc.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.13 | 3,566 | 11/22/2024 |
0.1.13-hc15-001 | 40 | 11/22/2024 |
0.1.10 | 200 | 11/18/2024 |
0.1.10-hc15-001 | 37 | 11/18/2024 |
0.1.9 | 596 | 10/19/2024 |
0.1.9-hc15-001 | 73 | 10/19/2024 |
0.1.8 | 264 | 9/25/2024 |
0.1.7 | 85 | 9/25/2024 |
0.1.6 | 58 | 9/25/2024 |
0.1.5 | 54 | 9/25/2024 |
0.1.4 | 61 | 9/24/2024 |
0.1.3 | 69 | 9/23/2024 |
0.1.2 | 66 | 9/23/2024 |
0.1.1 | 60 | 9/23/2024 |
0.1.0 | 64 | 9/23/2024 |