github Effect-TS/effect @effect/schema@0.68.12

latest releases: @effect/schema@0.68.14, @effect/sql-sqlite-wasm@0.3.16, @effect/sql-sqlite-react-native@0.6.16...
3 days ago

Patch Changes

  • #3101 d990544 Thanks @gcanti! - Generate JSON Schemas correctly for a schema created by extending two refinements using the extend API, ensuring their JSON Schema annotations are preserved.

    Example

    import { JSONSchema, Schema } from "@effect/schema";
    
    const schema = Schema.Struct({
      a: Schema.String,
    })
      .pipe(Schema.filter(() => true, { jsonSchema: { a: 1 } }))
      .pipe(
        Schema.extend(
          Schema.Struct({
            b: Schema.Number,
          }).pipe(Schema.filter(() => true, { jsonSchema: { b: 2 } })),
        ),
      );
    
    console.log(JSONSchema.make(schema));
    /*
    {
      '$schema': 'http://json-schema.org/draft-07/schema#',
      type: 'object',
      required: [ 'a', 'b' ],
      properties: {
        a: { type: 'string', description: 'a string', title: 'string' },
        b: { type: 'number', description: 'a number', title: 'number' }
      },
      additionalProperties: false,
      b: 2,
      a: 1
    }
    */
  • Updated dependencies [a047af9]:

    • effect@3.4.5

Don't miss a new effect release

NewReleases is sending notifications on new releases.