Patch Changes
-
#3143
d006cec
Thanks @gcanti! - Enhance JSON Schema Support for Refinements in Record Parameters.Enhanced
JSONSchema.make
to properly support refinements as record parameters. Previously, using refinements withSchema.Record
resulted in errors when generating JSON schemas.Before
import { JSONSchema, Schema } from "@effect/schema"; const schema = Schema.Record( Schema.String.pipe(Schema.minLength(1)), Schema.Number, ); console.log(JSONSchema.make(schema)); /* throws Error: Unsupported index signature parameter schema (Refinement): a string at least 1 character(s) long */
Now
import { JSONSchema, Schema } from "@effect/schema"; const schema = Schema.Record( Schema.String.pipe(Schema.minLength(1)), Schema.Number, ); console.log(JSONSchema.make(schema)); /* Output: { '$schema': 'http://json-schema.org/draft-07/schema#', type: 'object', required: [], properties: {}, patternProperties: { '': { type: 'number' } }, propertyNames: { type: 'string', description: 'a string at least 1 character(s) long', minLength: 1 } } */
-
#3149
cb22726
Thanks @tim-smart! - add Serializable.WithResult.Success/Error inference helpers -
#3139
e911cfd
Thanks @gcanti! - Optimize JSON Schema output for homogeneous tuples (such as non empty arrays).This change corrects the JSON Schema generation for
S.NonEmptyArray
to eliminate redundant schema definitions. Previously, the element schema was unnecessarily duplicated under bothitems
andadditionalItems
.