Skip to content

feat: add optional Pydantic / JSON schema hooks for OpenAPI body #9

Description

@ZhuchkaTriplesix

Context

  • openapi_add_path produces a bare 200 with no content. Users expect application/json schemas for bodies.

Options

  1. Python-only: at route time, pass optional body_model=MyPydanticModel to the decorator; Rust only stores a JSON Schema string generated in Python (model_json_schema()) in RouteEntry; merge into the OpenAPI document on freeze().
  2. Rust-only: stay minimal. Prefer (1) to avoid reimplementing Pydantic in Rust.

Acceptance criteria

  • /openapi.json includes requestBody for at least one POST route.

Research

  • Pydantic v2 JSON schema $defs; size of inline vs $ref in OAS 3.0.3.

Activity

  1. added this to the v0.2.0 milestone on Apr 26, 2026
  2. added a commit that references this issue on Apr 26, 2026
  3. added a commit that references this issue on Apr 26, 2026
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 request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions