Skip to content

Issue 09: Error Contract http_status Enforcement #9

@laraibg786

Description

@laraibg786

Goal

Ensure all API error responses consistently include the http_status field, completing the error contract defined in #5.

Requirements

Functional

  • Update the canonical error schema to include http_status as a required field.
  • Ensure error.http_status always matches the actual HTTP response status code.
  • Apply the updated schema to all exception handlers.
  • Verify the OpenAPI spec reflects http_status as a required integer field.

Technical

  • Updated Model:
    class ErrorDetail(BaseModel):
        code: str
        message: str
        http_status: int  # Required, matches HTTP status code
        details: dict = {}
        request_id: str
  • Complete Error Code Catalog: VALIDATION_FAILED (422), AUTH_INVALID (401), AUTH_EXPIRED (401), AUTH_FORBIDDEN (403), RESOURCE_NOT_FOUND (404), CONFLICT (409), INTERNAL_ERROR (500), LICENSE_NOT_FOUND (404), LICENSE_REVOKED (409), LICENSE_EXPIRED (409).

Acceptance Criteria

  • All error responses include http_status matching the HTTP status code.
  • OpenAPI spec marks http_status as required in the error schema.
  • Contract conformance tests pass for all representative error paths.

Dependencies

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions