Skip to content

Add Suave server integration package - #567

Draft
xperiandri with Copilot wants to merge 3 commits into
devfrom
copilot/add-suave-integration-support
Draft

Add Suave server integration package#567
xperiandri with Copilot wants to merge 3 commits into
devfrom
copilot/add-suave-integration-support

Conversation

Copilot AI commented May 17, 2026

Copy link
Copy Markdown
Contributor

This adds an official Suave integration package for FSharp.Data.GraphQL, following the existing Giraffe/Oxpecker shape. The new package exposes GraphQL as a Suave WebPart so it can be embedded directly into larger Suave applications.

  • New Suave integration package

    • adds FSharp.Data.GraphQL.Server.Suave
    • exposes:
      • HttpHandlers.graphQL
      • HttpHandlers.setRequestType
    • supports the existing server behaviors needed for:
      • GET introspection requests
      • POST JSON GraphQL requests
      • multipart upload requests
  • Request handling model

    • maps Suave request data into the existing GraphQL execution flow instead of introducing a parallel server path
    • includes a Suave-specific IInputExecutionContext implementation for file uploads
    • preserves the existing Request-Type response header convention used by the current integrations
  • Packaging and build wiring

    • adds the new project to solution files
    • includes the package in shared dependency management
    • wires pack/push targets into the build script alongside the other server integration packages
  • Focused coverage

    • adds targeted tests for the Suave handler covering:
      • JSON query execution
      • GET introspection
      • multipart file upload execution

Example usage:

open Suave
open Suave.Operators
open FSharp.Data.GraphQL.Server.Suave

let app =
    HttpHandlers.setRequestType
    >=> HttpHandlers.graphQL Schema.executor rootFactory

Copilot AI linked an issue May 17, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for Suave integration similar to Giraffe/Oxpecker Add Suave server integration package May 17, 2026
Copilot AI requested a review from xperiandri May 17, 2026 14:44
@njlr

njlr commented May 17, 2026

Copy link
Copy Markdown
Contributor

@copilot Does this support websocket aspects of GraphQL spec?

@xperiandri

Copy link
Copy Markdown
Collaborator

@copilot Does this support websocket aspects of GraphQL spec?

@copilot answer, please.
Check the WebSockets implementation in ASP.NET Core project and can it be used or is it referenced by Suave support implementation and give an answer

Copilot AI commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Does this support websocket aspects of GraphQL spec?

@copilot answer, please.
...

Checked this in the current implementation at 46c8871: no, the Suave package does not support the WebSocket/GraphQL-over-WebSocket part right now.

What exists today in FSharp.Data.GraphQL.Server.Suave is only HTTP handling for GET/POST in src/FSharp.Data.GraphQL.Server.Suave/HttpHandlers.fs. There is no WebSocket route, no socket accept flow, and no reference to the ASP.NET Core WebSocket middleware.

The WebSocket implementation lives in src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLWebsocketMiddleware.fs and is wired through UseWebSocketsForGraphQL in src/FSharp.Data.GraphQL.Server.AspNetCore/ServiceCollectionExtensions.fs. The Suave project does not reference FSharp.Data.GraphQL.Server.AspNetCore, so that middleware is not reused by the Suave integration.

So the short answer is: HTTP GraphQL is supported in Suave, WebSocket GraphQL is not. Reusing the ASP.NET Core implementation as-is would not work directly; it would need either a Suave-specific WebSocket adapter or a refactor that extracts the transport-agnostic parts into shared code.

@njlr

njlr commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Can @copilot implement web sockets?

@xperiandri
xperiandri force-pushed the copilot/add-suave-integration-support branch from 7be94f3 to f2196b0 Compare August 11, 2026 13:15
@xperiandri

Copy link
Copy Markdown
Collaborator

WebSockets are already implemented and packaged in ASP.NET Core project (as far as I remember)

@njlr

njlr commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

WebSockets are already implemented and packaged in ASP.NET Core project (as far as I remember)

IIUIR Suave is outside of ASP.NET so this would need an implementation built on top of Suave socket. Not sure if this is too much to ask of Copilot but maybe it will get it?

Copilot AI and others added 3 commits August 11, 2026 15:30
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/1f4b9b83-930c-43b3-a8a5-8cf795269b9d

Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/1f4b9b83-930c-43b3-a8a5-8cf795269b9d

Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/1f4b9b83-930c-43b3-a8a5-8cf795269b9d

Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
@xperiandri
xperiandri force-pushed the copilot/add-suave-integration-support branch from f2196b0 to c4cfcc3 Compare August 11, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Suave package

3 participants