Coder Social home page Coder Social logo

Comments (4)

sinclairzx81 avatar sinclairzx81 commented on May 22, 2024 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.

btisdall avatar btisdall commented on May 22, 2024

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.

sinclairzx81 avatar sinclairzx81 commented on May 22, 2024

@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.

sinclairzx81 avatar sinclairzx81 commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.