Comments (4)
@dsmyda Hi. Yes, there is a bit of flux going on currently with respect to additionalProperties
handling in TypeBox, apologies. An update on 0.15.x
changed things to enforce additionalProperties: false
for all object types. The intent was to mandate that all unexpected properties were caught, but there's been some downstream problems with this approach (both finding a reasonable schema representation as well as some typescript inference issues also).
In a future release (likely the next minor revision), I will be reverting things back such that additionalProperties
can be provided as a CustomOption
. In the interim, I would recommend keeping on with 0.14.1
if you need configurable additionalProperties
.
Thanks for letting me know :)
from typebox.
Hi and first of all thanks a lot for a really useful library! Regarding the issue at hand here, it seems the change to allow setting additionalProperties
once again has not yet been made, are you able to give an update on when this will happen or should I just use 0.14.1 and stop worrying :) On a more general note, though this libary has such game-changing potential for node/TS development I slightly get the vibe that you haven't had much time to develop it recently and it would be super helpful if you could set expectations for users in this regard. Again, thanks a lot!
from typebox.
@btisdall Hey thanks. Yes, I do apologize for the delay on this. I have been putting off this update for sometime mainly due to it being a potential breaking change for some users, as well as being somewhat preoccupied with a few things inside and outside of work). But I am sorry for the delay.
Just to let you know, I've just published a new version of TypeBox 0.17.0
which removes the additionalProperties: false
constraint on Type.Object({...})
and Type.Intersect({ ... })
specifically. Users will now need to explicitly opt into additionalProperties: false
to disallow additional properties appearing on the object. Documentation for this has been added to the project readme which you can read about here. https://github.com/sinclairzx81/typebox#AdditionalProperties
const T = Type.Object({ a: Type.Number() }, { additionalProperties: false })
This update crosses over with a couple of other things going on related to composition of Type.Intersect({ ... })
and how TypeBox should express TypeScript intersections as schemas. I've added a bit of a write up to the PR for 0.17.0
that hopefully brings a little bit of insight into some of the reasoning going on there. You can read about it here #77.
I slightly get the vibe that you haven't had much time to develop it recently and it would be super helpful if you could set expectations for users in this regard. Again, thanks a lot!
Would certainly be open to ideas on how to better communicate expectations to users. Would be curious to find out how other OSS projects manage this.
Many Thanks
from typebox.
Will close off this issue for the time being. @btisdall Feel free to respond to the above if you have suggestions on better communicating expectations. Thanks all.
from typebox.
Related Issues (20)
- JsonTypeBuilder#Record not passing on options HOT 1
- No implicit defaults on Value.Create() HOT 5
- [BUG] Value.create caches the default date HOT 1
- Feature request: Value.Assert and TypeCheck.Assert HOT 3
- [Feature Request?] allow more flexible input for string pattern HOT 3
- Individual types imports naming conflict with native classes HOT 4
- Strict error: Unknown type HOT 2
- Maximum call stack size exceeded. HOT 2
- TUnion of literals from const array HOT 2
- "Value.Clean" doesn't work with Unions of objects with prohibited additionalProperties HOT 3
- JS floating point precision bug causes multipleOf validation to fail HOT 4
- Tuple with rest items (or Array with prefixedItems) HOT 2
- useDefaults HOT 3
- Support for discriminator HOT 1
- Support for self-referencing fields of recursive type HOT 2
- Property '[Kind]' is missing in type 'TObject' but required in type 'TObject<TProperties>' HOT 3
- [feat] Bail / Early Cancel Mode HOT 1
- Setting Description HOT 1
- Schema dependency using Typebox HOT 3
- Composite working uncorrect HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typebox.