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

latest releases: @effect/typeclass@0.24.40, @effect/printer@0.33.40, @effect/printer-ansi@0.33.40...
7 days ago

Patch Changes

  • #3117 cb76bcb Thanks @gcanti! - Modified JSONSchema.make to selectively ignore the title and description fields in schema types such as Schema.String, Schema.Number, and Schema.Boolean, closes #3116

    Before

    import { JSONSchema, Schema as S } from "@effect/schema";
    
    const schema = S.Struct({
      foo: S.String,
      bar: S.Number,
    });
    
    console.log(JSONSchema.make(schema));
    /*
    {
      '$schema': 'http://json-schema.org/draft-07/schema#',
      type: 'object',
      required: [ 'foo', 'bar' ],
      properties: {
        foo: { type: 'string', description: 'a string', title: 'string' },
        bar: { type: 'number', description: 'a number', title: 'number' }
      },
      additionalProperties: false
    }
    */

    Now

    import { JSONSchema, Schema as S } from "@effect/schema";
    
    const schema = S.Struct({
      foo: S.String,
      bar: S.Number,
    });
    
    console.log(JSONSchema.make(schema));
    /*
    {
      '$schema': 'http://json-schema.org/draft-07/schema#',
      type: 'object',
      required: [ 'foo', 'bar' ],
      properties: { foo: { type: 'string' }, bar: { type: 'number' } },
      additionalProperties: false
    }
    */

Don't miss a new effect release

NewReleases is sending notifications on new releases.