Skip to content

feat: implement RFC 9457 Phase 2 — application/problem+json and content negotiation #464

@Aureliolo

Description

@Aureliolo

Summary

Complete the RFC 9457 implementation by adding application/problem+json content type, type URI documentation links, content negotiation, and the remaining standard fields.

Phase 1 (#419, implemented in PR #457) added the core error metadata (ErrorCategory, ErrorCode, ErrorDetail, retryable, retry_after, instance). Phase 2 makes the API fully RFC 9457 compliant.

Design (from #419 Phase 2)

  • application/problem+json content type on error responses
  • type URI field linking to error documentation (e.g. https://synthorg.io/docs/errors/validation)
  • Content negotiation middleware via Accept header — clients that send Accept: application/problem+json get RFC 9457 format; others get the current ApiResponse envelope
  • title field — human-readable summary of the error type (static per category)
  • detail field — occurrence-specific human-readable explanation

Scope

  • Add title and detail fields to ErrorDetail
  • Add type URI field (points to docs error reference)
  • Content negotiation: Accept: application/problem+json returns RFC 9457 format directly (not wrapped in ApiResponse)
  • Default behavior unchanged — ApiResponse envelope with error_detail field (backward compatible)
  • Error documentation page at docs/errors/ listing all error codes and categories
  • Update OpenAPI schema to document both response formats

Dependencies

Acceptance Criteria

  • Error responses include type, title, detail fields
  • Accept: application/problem+json returns RFC 9457 format directly
  • Default response format unchanged (backward compatible)
  • Error documentation page generated/written
  • type URIs resolve to documentation
  • OpenAPI schema documents both response formats
  • Content negotiation tested with both Accept header values

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingscope:medium1-3 days of workspec:human-interactionDESIGN_SPEC Section 13 - Human Interaction Layertype:featureNew feature implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions