Packages

effect

4.1.4 · 11 Nov 2026MIT66.6M / weekRepositoryHomepagenpmAtom feed

Your version

3.18.3

6 Oct 2025Where it was published

3.22.5 is the newest release of 3.x.

In short

1 fixed

Security

2 advisories affect 3.18.3; 3.22.1 fixes them

Release note

Patch Changes

  • Fix JSON Schema generation with topLevelReferenceStrategy: "skip", closes #5611

    This patch fixes a bug that occurred when generating JSON Schemas with nested schemas that had identifiers, while using topLevelReferenceStrategy: "skip".

    Previously, the generator would still output $ref entries even though references were supposed to be skipped, leaving unresolved definitions.

    Before

    import { JSONSchema, Schema } from "effect"
    
    const A = Schema.Struct({ value: Schema.String }).annotations({
      identifier: "A"
    })
    const B = Schema.Struct({ a: A }).annotations({ identifier: "B" })
    
    const definitions = {}
    console.log(
      JSON.stringify(
        JSONSchema.fromAST(B.ast, {
          definitions,
          topLevelReferenceStrategy: "skip"
        }),
        null,
        2
      )
    )
    /*
    {
      "type": "object",
      "required": ["a"],
      "properties": {
        "a": {
          "$ref": "#/$defs/A"
        }
      },
      "additionalProperties": false
    }
    */
    console.log(definitions)
    /*
    {
      A: {
        type: "object",
        required: ["value"],
        properties: { value: [Object] },
        additionalProperties: false
      }
    }
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    const A = Schema.Struct({ value: Schema.String }).annotations({
      identifier: "A"
    })
    const B = Schema.Struct({ a: A }).annotations({ identifier: "B" })
    
    const definitions = {}
    console.log(
      JSON.stringify(
        JSONSchema.fromAST(B.ast, {
          definitions,
          topLevelReferenceStrategy: "skip"
        }),
        null,
        2
      )
    )
    /*
    {
      "type": "object",
      "required": ["a"],
      "properties": {
        "a": {
          "type": "object",
          "required": ["value"],
          "properties": {
            "value": { "type": "string" }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
    */
    console.log(definitions)
    /*
    {}
    */

    Now schemas are correctly inlined, and no leftover $ref entries or unused definitions remain.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.