Skip to content

Generate two-tier raw/cooked service methods #55

Description

@OmarAlJarrah

Problem

Callers sometimes need headers/status without paying for deserialization.

Proposed change

Generate each operation in two tiers — a cooked method returning the parsed body, and a raw method returning a lazy ParsedResponse<T> whose parse() consumes/closes the body. Compose error-mapping + deserialization as Response -> X handlers at the generated-service layer (not as HTTP-pipeline stages — the pipeline stays transport-pure and keeps returning a raw Response). Rely on Closeable + use {} + KDoc; don't pull in a @MustBeClosed lint annotation.

Prior art: openai-java's withRawResponse() services (ModelServiceImpl.kt).

Acceptance

  • Raw + cooked tiers generated
  • Error-mapping composed at the service layer
  • Test

Builds on the ResponseHandler seam.

Dependencies


Priority: high · Effort: medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegenfuture KotlinPoet codegenenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions