Skip to main content

Module infer

Module infer 

Source
Expand description

Type inference, name validation, and default columns.

Upstream: getType and getObjectType (SchemaController.js:1555-1640), plus classNameIsValid and fieldNameIsValid (:446-480).

Inference is what makes Parse’s schema implicit: the first write that mentions a field decides its type forever. Everything downstream, including the error a client sees on the second write, follows from getting this exactly right.

Constants§

DEFAULT_COLUMNS
The four columns every class has (defaultColumns._Default).
INVALID_COLUMNS
Field names no class may use (invalidColumns, SchemaController.js:163).
SYSTEM_CLASSES
Classes Parse defines itself (systemClasses, SchemaController.js:165-176).
USER_COLUMNS
The additional default columns of _User (defaultColumns._User).
VOLATILE_CLASSES
Classes held in memory rather than loaded from _SCHEMA (volatileClasses, SchemaController.js:178-187).

Functions§

class_name_is_valid
Is this a class a client may address?
default_columns_for
The additional default columns of one class, or empty for a class that has none.
field_name_is_valid
Field names a client may not use at all.
field_name_is_valid_for_class
Additionally refuses the default columns, which a client cannot redefine.
infer_op_type
Infer a field type from an operation, as getObjectType’s __op arm does (SchemaController.js:1634-1655).
infer_type
Infer a field type from a value, as getType does.
invalid_class_name_message
invalidClassNameMessage (SchemaController.js:483-489).
is_default_column
Is this field a default column of this class, counting both _Default and the class’s own?
required_read_columns
Columns that must be present for a read of a class (requiredColumns.read, SchemaController.js:154-156).
required_write_columns
Columns that must be present for a write to a class to be accepted (requiredColumns.write, SchemaController.js:157-160).
schema_mismatch
The INCORRECT_TYPE a client sees when a write disagrees with the stored type.