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.
JSONSchema
JSONSchema: Missing jsonSchema annotation
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.
JSONSchema: Missing identifier annotation for recursive schemas
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.
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.
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
1
import {
import Schema
Schema } from"effect"
2
3
// Schema with a symbol key (not allowed in JSON Schema)
4
const
constschema:Schema.Struct<{
[x:symbol]:typeof Schema.String;
}>
schema=
import Schema
Schema.
functionStruct<{
[x:symbol]:typeof Schema.String;
}>(fields: {
[x:symbol]:typeof Schema.String;
}):Schema.Struct<{
[x:symbol]:typeof Schema.String;
}> (+1overload)
@since ― 3.10.0
Struct({
5
[
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.
@param ― key key to search for.
for("my-symbol")]:
import Schema
Schema.
classString
exportString
@since ― 3.10.0
String
6
})
as there is no way to represent this in JSON Schema.