Skip to content

Releases: Effect-TS/effect

@effect/[email protected]

31 Mar 22:02
8883c83
Compare
Choose a tag to compare

@effect/[email protected]

31 Mar 02:38
a10d396
Compare
Choose a tag to compare

@effect/[email protected]

31 Mar 22:02
8883c83
Compare
Choose a tag to compare

@effect/[email protected]

31 Mar 02:38
a10d396
Compare
Choose a tag to compare

[email protected]

25 Mar 17:02
f0c5a24
Compare
Choose a tag to compare

Patch Changes

  • #4646 f87991b Thanks @gcanti! - SchemaAST: add missing getSchemaIdAnnotation API

  • #4646 f87991b Thanks @gcanti! - Arbitrary: fix bug where annotations were ignored.

    Before

    import { Arbitrary, Schema } from "effect"
    
    const schema = Schema.Int.annotations({
      arbitrary: (_, ctx) => (fc) => {
        console.log("context: ", ctx)
        return fc.integer()
      }
    }).pipe(Schema.greaterThan(0), Schema.lessThan(10))
    
    Arbitrary.make(schema)
    // No output ❌

    After

    import { Arbitrary, Schema } from "effect"
    
    const schema = Schema.Int.annotations({
      arbitrary: (_, ctx) => (fc) => {
        console.log("context: ", ctx)
        return fc.integer()
      }
    }).pipe(Schema.greaterThan(0), Schema.lessThan(10))
    
    Arbitrary.make(schema)
    /*
    context:  {
      maxDepth: 2,
      constraints: {
        _tag: 'NumberConstraints',
        constraints: { min: 0, minExcluded: true, max: 10, maxExcluded: true },
        isInteger: true
      }
    }
    */
  • #4648 0a3e3e1 Thanks @gcanti! - Schema: standardSchemaV1 now includes the schema, closes #4494.

    This update fixes an issue where passing Schema.standardSchemaV1(...) directly to JSONSchema.make would throw a TypeError. The schema was missing from the returned object, causing the JSON schema generation to fail.

    Now standardSchemaV1 includes the schema itself, so it can be used with JSONSchema.make without issues.

    Example

    import { JSONSchema, Schema } from "effect"
    
    const Person = Schema.Struct({
      name: Schema.optionalWith(Schema.NonEmptyString, { exact: true })
    })
    
    const standardSchema = Schema.standardSchemaV1(Person)
    
    console.log(JSONSchema.make(standardSchema))
    /*
    {
      '$schema': 'http://json-schema.org/draft-07/schema#',
      '$defs': {
        NonEmptyString: {
          type: 'string',
          description: 'a non empty string',
          title: 'nonEmptyString',
          minLength: 1
        }
      },
      type: 'object',
      required: [],
      properties: { name: { '$ref': '#/$defs/NonEmptyString' } },
      additionalProperties: false
    }
    */

@effect/[email protected]

25 Mar 17:03
f0c5a24
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

25 Mar 17:03
f0c5a24
Compare
Choose a tag to compare

Patch Changes

@effect/[email protected]

25 Mar 17:02
f0c5a24
Compare
Choose a tag to compare

@effect/[email protected]

25 Mar 17:03
f0c5a24
Compare
Choose a tag to compare

@effect/[email protected]

25 Mar 17:02
f0c5a24
Compare
Choose a tag to compare