Skip to content

docs: document RFC 9457 dual response formats in OpenAPI schema #494

@Aureliolo

Description

@Aureliolo

Summary

The OpenAPI schema does not document the application/problem+json response format introduced in #464. Clients relying on the OpenAPI spec to discover the content negotiation feature will not know it exists.

Context

PR #464 (RFC 9457 Phase 2) added content negotiation: clients sending Accept: application/problem+json receive bare RFC 9457 ProblemDetail responses instead of the ApiResponse envelope. However, the OpenAPI schema generation (scripts/export_openapi.py) was not updated to reflect this, since content negotiation happens in exception handlers (not in controller return types) and Litestar's auto-generation does not discover it.

Scope

  • Add ProblemDetail as an alternative error response schema in the OpenAPI spec
  • Document the Accept: application/problem+json content negotiation behavior
  • This likely requires Litestar app-level responses configuration or custom OpenAPI schema hooks
  • Update scripts/export_openapi.py if needed

Acceptance Criteria

  • OpenAPI schema includes ProblemDetail schema definition
  • Error responses document both application/json (envelope) and application/problem+json (bare) content types
  • Generated API reference page (Scalar UI) shows both response formats

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingscope:smallLess than 1 day of worktype:docsDocumentation work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions