Skip to content

Effect 4 schemas get no options, only --json #231

Open

Description

@FluteBlade

The peer range allows effect ^4.0.0, but an Effect 4 schema gets no options. With effect 4.0.5 and trpc-cli 0.17.1:

import { Schema } from "effect";
import { createCli, os } from "trpc-cli";

const input = Schema.toStandardSchemaV1(Schema.Struct({ name: Schema.String }));
const router = os.router({ greet: os.input(input).handler(({ input }) => `hi ${input.name}`) });
await createCli({ router }).run();

greet --help lists only --json, with "procedure's schema couldn't be converted to CLI arguments: Failed to convert input to JSON Schema: Cannot read properties of undefined (reading 'make')". Effect 4 has no JSONSchema module. Its JSON Schema comes from Schema.toStandardJSONSchemaV1(schema)["~standard"].jsonSchema.input({ target: "draft-07" }). A schema wrapped in it fails the same way, since the Effect converter is tried before a schema's own ~standard.jsonSchema.

That alone is not enough, though. Effect 4 writes "additionalProperties": true on a struct, and handleMergedSchema refuses any truthy additionalProperties with "Inputs with additional properties are not currently supported". Since true is JSON Schema's default, it could be treated like an absent additionalProperties. With both changes, greet --help lists --name <string>, greet --name Ada prints "hi Ada", and leaving out --name is reported as a missing required option.

For now we pass an effect dependency whose JSONSchema.make does both. The README's Effect example also uses Schema.standardSchemaV1, which Effect 4 calls Schema.toStandardSchemaV1.

Activity

  1. pullfrog commented on Oct 24, 2026

    @pullfrog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions