Skip to content

Add Effect schema and HttpApiClient plugins #706

Description

@nmnmcc

Motivation

Kubb already generates TypeScript types, runtime schemas, and HTTP clients from OpenAPI through focused plugins. In an Effect project, generated TypeScript types are only part of what the application needs. Effect APIs use Schema values for runtime decoding and HttpApi contracts for typed clients, so users still have to maintain a second model and endpoint layer by hand.

Effect support would keep the OpenAPI document as the source of truth for:

  • Effect schemas and inferred TypeScript types
  • path, query, header, cookie, body, and response definitions
  • grouped HttpApi endpoints and a typed HttpApiClient
  • security layers that plug into Effect's service and layer model

This removes hand-written glue and keeps runtime validation aligned with the generated types. It also lets OpenAPI formats map to Effect-native values, such as date-time to DateTime.Utc and JSON int64 to a number-to-bigint codec.

Proposed plugin split

  • @kubb/plugin-effect generates Effect Schema definitions and matching TypeScript types. It can be used on its own.
  • @kubb/plugin-effect-httpapiclient composes those schemas into HttpApi groups and endpoints and a typed HttpApiClient, including parameter serialization, cookies, responses, and authentication layers.

This split follows Kubb's opt-in plugin model. Projects that only need schemas do not have to adopt the HTTP client integration.

Current prototype

PR #696 contains a working implementation with examples and regression tests. The related documentation is in kubb-labs/docs#145.

The current prototype targets the Effect v4 beta. It can be rebased and aligned with Kubb v5 after the v5 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions