Enforce input/output kind safety for ListOf/Nullable wrappers at compile time#569
Merged
Merged
Conversation
xperiandri
reviewed
May 17, 2026
Copilot
AI
changed the title
[WIP] Fix validation of ListOf and Nullable types
Enforce input/output kind safety for May 17, 2026
ListOf/Nullable wrappers at compile time
1fb9e12 to
ca08d98
Compare
xperiandri
requested changes
May 17, 2026
ca08d98 to
39decb4
Compare
945c831 to
e1fab18
Compare
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/7e806543-4139-4145-940a-64322cdd35cd Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/7e806543-4139-4145-940a-64322cdd35cd Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
…tions Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/1a91a357-4922-4da3-92d3-9ffe65b3cb73 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Introduce a new test suite to verify compile-time enforcement of input/output directionality for ListOf, Nullable, and StructNullable wrappers. Replace previous inline tests with F# script-based checks that are executed via dotnet fsi. Update the test project to include these scripts as content files and ensure References.fsx is managed and ignored appropriately.
29517ee to
0e567bd
Compare
Juriyx
approved these changes
May 17, 2026
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.
ListOf,Nullable, andStructNullablewere previously kind-agnostic wrappers, so input types could be wrapped and consumed as output types (and vice versa), producing invalid schemas only detected at runtime. This change makes wrapper direction explicit in the type system and resolved at compile time.Changes Made
InputOutputDef/InputOutputDef<'Val>) for defs valid in both input and output contexts.Nullable,StructNullable, andListOfto resolve by kind at compile time:InputDef<'T>→ input wrapperOutputDef<'T>→ output wrapperInputOutputDef<'T>→ dual-capable wrapperTypeWrappersKindSafetyTests) to verify wrapper direction is preserved for input-only/output-only types.Connections.fsby reverting helper-based wrapper indirection and keeping directNullableusage at call sites.Validation
dotnet test tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsprojdotnet test tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsproj --no-build