Skip to main content

validate_new_class

Function validate_new_class 

Source
pub fn validate_new_class(
    class_name: &str,
    fields: &ParseMap,
    clp: Option<ParseMap>,
    opts: ClpValidation,
) -> Result<ClassSchema, ParseError>
Expand description

Validate a POST /schemas/:className body and produce the schema to create.

Order of checks is upstream’s, and it is observable because the first failure is what the client sees: class name, then per field name, name-for-class, type, and options, then the GeoPoint count, then the CLP (validateNewClass at :1009-1020 into validateSchemaData at :1022-1093).

The “class already exists” check is not here. It needs the loaded schema set, which is the caller’s, and its message is Class <name> already exists. with INVALID_CLASS_NAME (:1011).