Constructor functions must return objects, so provided schema should also respect the same restriction.
Related Issue
91
Motivation and Context
Prior to this patch when a non-object schema was passed to Felicity.entityFor, the constructor function would be returned without error. However, when a new instance was instantiated, it would return an empty object despite having the instance.schema returning the correct non-object Joi schema.
This patch enforces object-typed Joi schema as the basis for constructor functions to maintain the parity of restrictions between schema and returned value for the constructors.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue. you didn't modify existing tests)
Description
Constructor functions must return objects, so provided schema should also respect the same restriction.
Related Issue
91
Motivation and Context
Prior to this patch when a non-object schema was passed to
Felicity.entityFor
, the constructor function would be returned without error. However, when a new instance was instantiated, it would return an empty object despite having theinstance.schema
returning the correct non-object Joi schema.This patch enforces object-typed Joi schema as the basis for constructor functions to maintain the parity of restrictions between schema and returned value for the constructors.
Types of changes
Checklist: