When using discriminators with explicit values (e.g., Base.discriminator('Child', ChildSchema, 'ExplicitValue')), the child schema can't be resolved correctly leading to an error "Cannot read properties of undefined (reading 'eachPath')" when using lean getters.
This change resolves the child schema using its explicit discriminator value if present, otherwise using its model name as is the default behaviour.
Related to #26
Examples
Added test should call getters on schemas with discriminator using explicit value
Summary
When using discriminators with explicit values (e.g.,
Base.discriminator('Child', ChildSchema, 'ExplicitValue')
), the child schema can't be resolved correctly leading to an error "Cannot read properties of undefined (reading 'eachPath')" when using lean getters.This change resolves the child schema using its explicit discriminator value if present, otherwise using its model name as is the default behaviour.
Related to #26
Examples
Added test
should call getters on schemas with discriminator using explicit value