Skip to content
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

Merged
merged 7 commits into from
Oct 8, 2023

Conversation

yishayweb
Copy link
Contributor

@yishayweb yishayweb commented Dec 29, 2022

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)

Copy link

@jchris jchris left a 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

@yishayweb
Copy link
Contributor Author

Thanks @jchris !!
I would also like to get an approval from someone that is more familiar with the code, but so far no luck with that :(
@kettanaito I saw you mentioned that you are rewriting the package to release a new major version. But is there a chance to insert this change to the current major version? Thanks !!

@diogomiguel
Copy link

This seems dead so @kettanaito Any chance you can review this as requested by OP? Quite keen on this functionality. Thanks 🙏

Copy link
Member

@kettanaito kettanaito left a 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.

@kettanaito kettanaito merged commit 1e7b2af into mswjs:main Oct 8, 2023
@kettanaito
Copy link
Member

Released: v0.14.0 🎉

This has been released in v0.14.0!

Make sure to always update to the latest version (npm i @mswjs/data@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants