OpenApiTransformer
OpenAPI-to-HttpClient code generation for the OpenAPI generator.
This module defines the OpenApiTransformer service used to render parsed OpenAPI operations into Effect HttpClient modules. It provides both schema-backed and type-only transformer implementations, including generated imports, public client interfaces, operation implementations, typed API errors, optional response handling, and helpers for server-sent events and binary response streams.
Code Generation
makeTransformerSchema
Signature
declare function makeTransformerSchema(): { readonly imports: (importName: string, parsed: ParsedOpenApi) => string; readonly toImplementation: (importName: string, name: string, parsed: ParsedOpenApi) => string; readonly toTypes: (importName: string, name: string, parsed: ParsedOpenApi) => string;};makeTransformerTs
Create the transformer used for type-only HttpClient output.
Details
Generated clients reference emitted TypeScript types directly and do not import schema decoders for JSON response bodies. Responses are typed as the declared operation result while preserving generated error and stream method shapes.
Signature
declare function makeTransformerTs(): { readonly imports: (importName: string, parsed: ParsedOpenApi) => string; readonly toImplementation: (importName: string, name: string, parsed: ParsedOpenApi) => string; readonly toTypes: (importName: string, name: string, parsed: ParsedOpenApi) => string;};Layers
layerTransformerSchema
Layer that provides the schema-backed OpenApiTransformer service.
When to use
Use when you use this layer when generated HttpClient code should perform runtime response decoding with generated Effect Schema values.
Signature
declare const layerTransformerSchema: Layer<OpenApiTransformer, never, never>;layerTransformerTs
Layer that provides the type-only OpenApiTransformer service.
When to use
Use when you use this layer for the httpclient-type-only generator format, where the generated client relies on TypeScript types instead of runtime Schema decoding.
Signature
declare const layerTransformerTs: Layer<OpenApiTransformer, never, never>;Services
OpenApiTransformer
Service used by the OpenAPI generator to render parsed operations as an Effect HttpClient module.
Details
A transformer owns the code-generation dialect for imports, public client types, and the implementation body. The generator swaps implementations to choose between schema-backed clients and type-only clients.
Signature
declare class OpenApiTransformer extends Shape< "OpenApiTransformer", { readonly imports: (importName: string, parsed: ParsedOpenApi) => string; readonly toImplementation: (importName: string, name: string, parsed: ParsedOpenApi) => string; readonly toTypes: (importName: string, name: string, parsed: ParsedOpenApi) => string; }, this> { constructor(_: never);}
Create the transformer used for schema-backed HttpClient output.
Details
Generated clients import Effect Schema values and use them at runtime to decode successful responses and typed API errors. Request parameters and payloads are typed against each schema's encoded representation.