Skip to content

perf(openapi): cache serialized openapi document #107

Description

@ZhuchkaTriplesix

Context

  • GET /openapi.json is served from state.openapi mutex; both sync and async paths call openapi.lock().to_string() per request (src/dispatch.rs).
  • OpenAPI document changes only at route registration / title update.

Problem

Repeated serialization and lock contention on a read-mostly document.

Proposed change

Files

  • src/state.rs, src/lib.rs, src/dispatch.rs

Acceptance criteria

  • /openapi.json body identical before/after change.
  • No per-request full JSON serialization on cache hit.
  • Tests cover route add and title change invalidation.

Expected low-level impact

Faster OpenAPI endpoint; less mutex work under load.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions