Skip to content

Effect (v3)

If you get stuck, please try discussing the issue on the Effect Discord or posting a question to Stackoverflow. If you’ve found a bug, or Effect can’t meet your needs, please try raising an issue.

This error occurs when attempting to generate a JSON Schema for a type that has no direct representation in JSON Schema, such as bigint.

To resolve this, add a jsonSchema annotation to specify how the type should be represented.

For refined schemas, ensure that each refinement includes a jsonSchema annotation that describes its constraints.

For more details, see Customizing JSON Schema Generation.

This error occurs when generating a JSON Schema for a recursive or mutually recursive schema that lacks an identifier annotation.

Recursive schemas need a unique identifier annotation to ensure correct references in the generated JSON Schema. Without it, the schema generator cannot resolve the self-referencing structure.

To resolve this, ensure that recursive schemas include an identifier annotation.

For more details, see Recursive and Mutually Recursive Schemas.

This error occurs when generating a JSON Schema for a tuple that includes post-rest elements, elements appearing after a rest parameter. JSON Schema does not support this structure.

Example

import {
import Schema
Schema
} from "effect"
// Element after a rest parameter ───┐
// Rest Parameter ────────────────┐ |
// ▼ ▼
const
const schema: Schema.TupleType<readonly [], [typeof Schema.Number, typeof Schema.String]>
schema
=
import Schema
Schema
.
function Tuple<readonly [], [typeof Schema.Number, typeof Schema.String]>(elements: readonly [], rest_0: typeof Schema.Number, rest_1: typeof Schema.String): Schema.TupleType<readonly [], [typeof Schema.Number, typeof Schema.String]> (+2 overloads)

@since3.10.0

Tuple
([],
import Schema
Schema
.
class Number
export Number

@since3.10.0

Number
,
import Schema
Schema
.
class String
export String

@since3.10.0

String
)

This error occurs when attempting to generate a JSON Schema for a structure that includes unsupported key types, such as symbol. JSON Schema only supports string-based keys.

Example

import {
import Schema
Schema
} from "effect"
// Schema with a symbol key (not allowed in JSON Schema)
const
const schema: Schema.Struct<{
[x: symbol]: typeof Schema.String;
}>
schema
=
import Schema
Schema
.
function Struct<{
[x: symbol]: typeof Schema.String;
}>(fields: {
[x: symbol]: typeof Schema.String;
}): Schema.Struct<{
[x: symbol]: typeof Schema.String;
}> (+1 overload)

@since3.10.0

Struct
({
[
var Symbol: SymbolConstructor
Symbol
.
SymbolConstructor.for(key: string): symbol

Returns a Symbol object from the global symbol registry matching the given key if found. Otherwise, returns a new symbol with this key.

@paramkey key to search for.

for
("my-symbol")]:
import Schema
Schema
.
class String
export String

@since3.10.0

String
})

as there is no way to represent this in JSON Schema.