new ObjectSchema(propsopt)
Creates an object schema object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
props |
Object |
<optional> |
{} | Keys must be strings, values must be schema objects. Passing props is the same as calling S.obj().props(props). |
Methods
-
patternProps(props)
-
A mapping of propertyProperties to schemas.
Parameters:
Name Type Description props
Object Keys must be regex, values must be schema -
prop(name, schema)
-
Set an object schema's object property.
Parameters:
Name Type Description name
String The name of the property. schema
BaseSchema Any subclass of BaseSchema. Schema gets locked. -
props(props)
-
A mapping of property names to schemas. Calls this.prop() in a loop.
Parameters:
Name Type Description props
Object Keys must be strings, values must be schema objects.