You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a category entity set up like in the example that optionally points to another category, creating a parent/child relationship. The topmost categories don't have a parent (so its parent attribute is nullable)
Ah, that works! So the trick is to leave out the optional references in the fixture.
If you don't like digging into this (I had a look at what the builder class does but couldn't figure out if class-transformer takes the typeorm annotations into account), I think a sentence in the docs would suffice.
I have a category entity set up like in the example that optionally points to another category, creating a parent/child relationship. The topmost categories don't have a parent (so its parent attribute is nullable)
My fixture looks like this:
I get an error when it tries to insert the fixture, because it tries to insert a second, empty category.
I've traced through the code to see what it's doing and it converts the
{parent:null}
from the fixture to an empty object{parent: {}}
in the Entity.The text was updated successfully, but these errors were encountered: