github Effect-TS/effect effect@3.18.4

latest releases: @effect/cluster@0.50.4, @effect/ai-google@0.9.0, @effect/ai@0.30.0...
16 hours ago

Patch Changes

  • #5617 6ae2f5d Thanks @gcanti! - JSONSchema: Fix issue where invalid defaults were included in the output.

    Now they are ignored, similar to invalid examples.

    Before

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.NonEmptyString.annotations({
      default: ""
    })
    
    const jsonSchema = JSONSchema.make(schema)
    
    console.log(JSON.stringify(jsonSchema, null, 2))
    /*
    Output:
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "description": "a non empty string",
      "title": "nonEmptyString",
      "default": "",
      "minLength": 1
    }
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.NonEmptyString.annotations({
      default: ""
    })
    
    const jsonSchema = JSONSchema.make(schema)
    
    console.log(JSON.stringify(jsonSchema, null, 2))
    /*
    Output:
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "description": "a non empty string",
      "title": "nonEmptyString",
      "minLength": 1
    }
    */

Don't miss a new effect release

NewReleases is sending notifications on new releases.