CLIKontractGenerators
← Generators

Models · OpenAPI

Generate Effect 3 schemas without a transport client.

Generates one Effect Schema file per component with decoded and encoded TypeScript types.

What it emits

Effect Schema declarationsDecoded and encoded TypeScript typesDirectional input/output schemas when read-only or write-only fields differSchema and service index files

Options

Options this generator adds on top of its base set. Set them under generator: in the target.

OptionDescriptionValuesDefault
effectMajorSelect the Effect Schema major version to generate.33
schemaModeUse `strict` to preserve authored component boundaries, or `normalize` to promote inline operation schemas before generation.strict | normalizestrict
audiencesExclude operations for named audiences across the entire selected OpenAPI source and target. Marker mode is not supported.object (exclude: string[])unset

Example

type: typescript-effectgenerates

Components with the same wire and runtime shape generate one schema plus decoded and encoded types. Read-only or write-only fields add separate input and output schemas and types.

sumr.yamlyaml
targets:
  - name: effect-schemas
    output: ./apps/service/src/contracts
    generator:
      type: typescript-effect
      effectMajor: 3
      schemaMode: strict
schemas/recipe.schema.tsts
import * as Schema from 'effect/Schema';

export const RecipeSchema = Schema.Struct({
  id: Schema.String,
  name: Schema.String,
});

export type Recipe = Schema.Schema.Type<typeof RecipeSchema>;
export type RecipeEncoded = Schema.Schema.Encoded<typeof RecipeSchema>;

Prerequisites

Generation fails when one of these is unmet, so check here first when a target stops producing output.

OptionRequiresConflicts with
effectMajorEffect 3 installed directly in the consuming Project—