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.
| Option | Description | Values | Default |
|---|---|---|---|
effectMajor | Select the Effect Schema major version to generate. | 3 | 3 |
schemaMode | Use `strict` to preserve authored component boundaries, or `normalize` to promote inline operation schemas before generation. | strict | normalize | strict |
audiences | Exclude operations for named audiences across the entire selected OpenAPI source and target. Marker mode is not supported. | object (exclude: string[]) | unset |
Example
type: typescript-effectgeneratesComponents 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.
targets:
- name: effect-schemas
output: ./apps/service/src/contracts
generator:
type: typescript-effect
effectMajor: 3
schemaMode: strictimport * 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.
| Option | Requires | Conflicts with |
|---|---|---|
effectMajor | Effect 3 installed directly in the consuming Project | — |