Publish
This commit is contained in:
15
changelog/0.17.1.md
Normal file
15
changelog/0.17.1.md
Normal file
@@ -0,0 +1,15 @@
|
||||
## [0.17.1](https://www.npmjs.com/package/@sinclair/typebox/v/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
|
||||
})
|
||||
Reference in New Issue
Block a user