Use [<Struct>] ? optional parameters and voption in executor middlewares and Schema - #617
Merged
Merged
Conversation
…dlewares and `Schema` * `IExecutorMiddleware` members return `voption` instead of `option` * `ExecutorMiddleware` and `Define.ExecutorMiddleware` take `[<Struct>] ?` sub-middlewares * `Define.QueryWeightMiddleware`, `Define.ObjectListFilterMiddleware` and `Define.LiveQueryMiddleware` take `[<Struct>] ?` arguments * `Schema` takes `[<Struct>] ?config` * README middleware sample updated, including the missing `postCompile` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Final review comments identify documentation and API-signature corrections that should be addressed before approval.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates executor middleware and Schema optional parameters to use struct options (voption), including implementations, tests, and documentation.
Changes:
- Migrates middleware values from
optiontovoption. - Applies
[<Struct>] ?parameters across middleware and schema APIs. - Updates tests and README examples.
| File | Summary | Final review notes |
|---|---|---|
tests/FSharp.Data.GraphQL.Tests/ExecutorMiddlewareTests.fs |
Updates middleware tests for voption. |
— |
src/FSharp.Data.GraphQL.Server/Schema.fs |
Converts schema configuration to a struct optional parameter. | — |
src/FSharp.Data.GraphQL.Server/Executor.fs |
Updates middleware APIs and execution handling. | Nit (1 vote): update documentation from “one to three” sub-middlewares to four. |
src/FSharp.Data.GraphQL.Server/DefineExtensions.fs |
Updates executor middleware factory parameters. | — |
src/FSharp.Data.GraphQL.Server.Middleware/MiddlewareDefinitions.fs |
Uses ValueSome/ValueNone. |
— |
src/FSharp.Data.GraphQL.Server.Middleware/DefineExtensions.fs |
Updates built-in middleware optional parameters. | — |
README.md |
Documents the revised middleware API. | Nit (3 votes): declare SchemaPostCompileMiddleware. Nit (1 vote): correct the interface block’s missing InputExecutionContextProvider and GQLResponse type. Nit (1 vote): correct the OperationExecutionMiddleware alias to use InputExecutionContextProvider and AsyncVal<GQLExecutionResult>. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Test Results 9 files 9 suites 15m 2s ⏱️ Results for commit 6d8e2a8. ♻️ This comment has been updated with latest results. |
xperiandri
force-pushed
the
struct-optional-args-executor-middleware
branch
from
October 1, 2026 21:27
9a6b30a to
6d8e2a8
Compare
xperiandri
added a commit
that referenced
this pull request
Oct 2, 2026
Since the `Executor` members take `[<Struct>] ?` optional parameters (#617), the solution does not compile with SDK `10.0.303`: its F# compiler accepts neither an `option` nor a `voption` after `?name =` for a struct optional parameter, while SDK `10.0.401` takes the `voption`. FSharp.Core moves along to `10.1.401`, the version SDK `10.0.401` ships. The F# compiler of `10.0.4xx` miscompiles resumable state machines in Debug (dotnet/fsharp#20466, fix backported in dotnet/fsharp#20692); the tests already avoid `taskSeq` blocks that suspend, and CI builds Release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xperiandri
added a commit
that referenced
this pull request
Oct 2, 2026
Since the `Executor` members take `[<Struct>] ?` optional parameters (#617), the solution does not compile with SDK `10.0.303`: its F# compiler accepts neither an `option` nor a `voption` after `?name =` for a struct optional parameter, while SDK `10.0.401` takes the `voption`. FSharp.Core moves along to `10.1.401`, the version SDK `10.0.401` ships. The F# compiler of `10.0.4xx` miscompiles resumable state machines in Debug (dotnet/fsharp#20466, fix backported in dotnet/fsharp#20692); the tests already avoid `taskSeq` blocks that suspend, and CI builds Release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Continues #601 and #604: the remaining reference optional parameters and
optionvalues aroundExecutornow use[<Struct>] ?andvoption.Changes
IExecutorMiddleware:CompileSchema,PostCompileSchema,PlanOperationandExecuteOperationAsyncreturnvoptioninstead ofoption.ExecutorMiddlewareandDefine.ExecutorMiddlewaretake[<Struct>] ?compile, ?postCompile, ?plan, ?execute.Define.QueryWeightMiddleware,Define.ObjectListFilterMiddlewareandDefine.LiveQueryMiddlewaretake[<Struct>] ?arguments.Schematakes[<Struct>] ?config.postCompileand uses named arguments, because the old positional call passed the planning function aspostCompile.Breaking changes
Custom
IExecutorMiddlewareimplementations must returnValueSome/ValueNoneinstead ofSome/None. Callers passing?config = someOption,?reportToMetadata = someOptionor?identityName = someOptionmust pass avoption. Calls that pass plain values do not change.Verification
dotnet build FSharp.Data.GraphQL.slnx: 0 warnings, 0 errorsFSharp.Data.GraphQL.Tests: 764 passed, 5 skipped, 0 faileddotnet build FSharp.Data.GraphQL.Integration.slnx: succeeded🤖 Generated with Claude Code