This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Issue with properties in complex objects and tests. #52
Comments
Thanks for reporting. This is an issue in the convector/@worldsibu/convector-core-model/src/convector-model.ts Lines 200 to 238 in e5db472
|
I had a look at that method, and did think should be be recursive - thanks for looking into it for me. |
Would all required checks + validation also need be recursive in this way. |
@crazyman1979 I don't think so, |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The problem
When passing a model to a controller in a test and that model has a property that is a simple class (not a convector model), any properties on that child class are not populated when hitting the controller method.
Details
I have a convector Model (lets call it Parent), this has a property called Child with a type of ChildClass (this is a simple class, not Convector model) - this child class has a property called Name (string).
I decorate all of my properties correctly and manually create the schema using yup for the plain old typescript object.
I have a simple controller with a method that just returns whats passed in (and calls .ToJSON()), i write a test that creates an instance of Parent, then creates and instance of Parent.Child and sets Name equal to "NAME".
i simply pass this instance of parent into my controller method - when i hit the controller method, my instance of Parent indeed has an instance of ChildClass in the .Child property but the Name property of this instance is not set.
When running this in the actual network, this does not happen - only in the test.
Current Behavior
Child properties of child classes are not populated on the way in to the controller.
Expected Behavior
All properties should be populated correctly.
Code To Reproduce Issue [ Good To Have ]
Models
Controller
Test
The text was updated successfully, but these errors were encountered: