Skip to content

Bug: parse: "none" omits body schema from OpenAPI docs #1720

@heiwen

Description

@heiwen

What version of Elysia is running?

1.4.22

What platform is your computer?

Darwin 25.2.0 arm64 arm

What environment are you using

Bun 1.3.7

Are you using dynamic mode?

no

Summary

Using parse: "none" is required to preserve raw request bodies, but it prevents the body schema from appearing in generated OpenAPI documentation. I still want the schema included for docs/typing even when parsing is disabled.

Expected Behavior

When parse: "none" is set, Elysia should still include the body schema in OpenAPI output (and ideally typing), even if runtime validation/parsing is skipped.

Actual Behavior

The body schema is omitted from OpenAPI docs when parse: "none" is present.

Reproduction

import { Elysia, t } from "elysia";
import { openapi } from "@elysiajs/openapi";

new Elysia()
  .use(openapi())
  .post(
    "/echo",
    ({ request }) => request,
    {
      body: t.Object({ input: t.String() }),
      parse: "none",
    },
  )
  .listen(3000);

Steps

  1. Open /openapi endpoint
  2. Check POST /echo request body schema.
  3. Observe it’s missing.

Notes

I need raw body handling, but still want accurate OpenAPI docs for clients.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions