PolymorphicObjectSchema(commonPropsopt, typeNameToObjopt, typeKeyopt)

A polymorphic type. The properties it contains will be based on its type. The type is determined by a specific property (by default named "type").

new PolymorphicObjectSchema(commonPropsopt, typeNameToObjopt, typeKeyopt)

Creates an object schema object.
Parameters:
Name Type Attributes Default Description
commonProps Object <optional>
{} Keys must be strings, values must be schema objects. Passed directly to the S.obj() constructor.
typeNameToObj Object <optional>
{} Keys are strings which are valid type names for this polymorphic object. Values are S.obj.
typeKey String <optional>
'type' The name of the property which determines which type of data this object has (all objects will have this property in addition to what's in commonProps).