deno.land / x / typebox@0.32.21 / changelog / 0.17.1.md

0.17.1

  • Remove default additionalProperties: false constraint from all object schemas.

This update removes the additionalProperties: false constraint on all object schemas. This constraint was introduced on 0.16.x but has resulted in significant downstream problems composing schemas whose types intersect. This is due to a JSON schema design principle where constraints should only be added (never removed), and that intersection types may require removal of the additionalProperties constraint in some cases, this had resulted in some ambiguity with respect to how TypeBox should handle such intersections.

This update can also be seen as a precursor towards TypeBox potentially leveraging unevaluatedProperties for type intersection in future releases. Implementers should take note that in order to constrain the schema to known properties, one should apply the additionalProperties: false as the second argument to Type.Object({...}).

```typescript const T = Type.Object({ a: Type.String(), b: Type.Number() }, { additionalProperties: false })

typebox

Version Info

Tagged at
4 weeks ago