-
Notifications
You must be signed in to change notification settings - Fork 519
Description
Hello I tried example of Providing more than one type option classes (https://github.com/typestack/class-transformer#providing-more-than-one-type-option).
When I call eg.
classToClass( plainToClass(Album, JSON.parse( "{\n" + " \"id\": 1,\n" + \"name\": \"foo\",\n" + " \"topPhoto\": {\n" + " \"id\": 9,\n" + " \"filename\": \"cool_wale.jpg\",\n" + " \"depth\": 1245,\n" + " \"__type\": \"underwater\"\n" + " }\n" + "}" ))
it works, but when topPhoto is null it fails. Eg.
classToClass( plainToClass(Album, JSON.parse( "{\n" + " \"id\": 1,\n" + " \"name\": \"foo\",\n" + " \"topPhoto\": null" + "}") ))
In documentation is written that discriminator must be defined (which is not in this case). Is there any workaround to pass this code without error (I want to avoid any wrapper classes)? Thanks.