-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: created nullable object option without getter #257
Conversation
…prove code documentation
…ates if it defaults to null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks this looks great. I am new to the project so take my approval with a grain of salt
Thanks @jchris !! |
This seems dead so @kettanaito Any chance you can review this as requested by OP? Quite keen on this functionality. Thanks 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this, @yishayweb 👏 Welcome to contributors.
Released: v0.14.0 🎉This has been released in v0.14.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
This PR is for supporting nullable objects without a getter function (mentioned in issue 203)
I took some inspiration from @roertbb solution, but solved it a little bit differently. I haven't changed the ModelValueType definition but rather made a new NullableObject class that accepts a value of the type NestedModelDefinition, since this is in fact what it should receive. It also accepts a second arg that indicates if the NullableObject should default to null (I made it so that the complete object definition will always be given while creating an instance of the class)
In general, I think that @kettanaito request here to implement it without a getter function makes a lot of sense as it is more consistent with regular nested objects (because we don't define them with a getter function as well)