Skip to content

Framework adapters: request extraction and context construction beyond the axum example #32

Open

Description

@XiNiHa

Problem

The axum example is the only integration and hand-writes the whole handler (examples/axum/src/main.rs:342-383): deserializing greem::http::Request, constructing the application context, negotiating Accept, turning the payload stream into a response. #21 moves the response half into greem::http. The request half is still per application: how C is built per request, how connection state (headers, auth, peer address) reaches it, and GET requests, Content-Type dispatch and application/graphql-response+json are not handled at all.

State at 71ccf70

Options

  • Stay transport-agnostic: greem::http gains GET parsing and a plain RequestParts { method, content_type, accept, body } -> Request step; each integration writes the few lines around it.
  • Adapter crates per framework (axum, actix-web, hyper) on top of the plain helpers, each with an extractor that builds C through a user closure over the request parts.
  • Both: plain helpers in greem::http, one greem-axum crate as the reference adapter.

Open questions

  • Is C built per request or per connection, and does greem need to know?
  • Which GraphQL-over-HTTP rules does greem enforce (status codes for request errors, media types) versus the adapter?
  • Should stream_capacity be overridable per request?

Blocked by #21.

Origin: Map: greem core, "Not yet specified" (request context construction, stream capacity tuning) and "Out of scope" (adapters beyond axum); tickets #7, #12, #14.

Activity

  1. XiNiHa commented on Oct 15, 2026

    @XiNiHa
    OwnerAuthor

    #47 lands this issue's first option, in greem::http without an HTTP crate:

    • GET parsing, Content-Type dispatch (POST takes application/json only) and the well-formedness checks;
    • 405 for a mutation over GET;
    • Accept negotiation with application/graphql-response+json.

    handle takes a plain RequestParts { method, query_string, content_type, accept, body }, and an http feature adds RequestParts::from_http and Response → http::Response<Body> conversions. The status code rules follow the GraphQL-over-HTTP draft (ADR-0012), which answers the open question of which rules greem enforces: greem enforces them all.

    Still open here:

    • how C is built per request (the context is still passed in, built by the integration);
    • adapter crates such as greem-axum;
    • a per-request stream_capacity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageMaintainer needs to evaluate this issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions