function registerSchema(schema) {
    var typename = getTypenameFromSchemaID(schema.id);
    var registered_schema = tv4.getSchema(schema.id);
    if (registered_schema == null) {
        var is_draft_schema = (schema.id === exports.DRAFT_SCHEMA_ID);
        if (!is_draft_schema) {
            if (typename == null) {
                // error typename not available from id
                return false;
            }
        }
        else {
            typename = exports.DRAFT_SCHEMA_TYPENAME;
        }
        var result = tv4_validateSchema(schema);
        if (result.errors.length === 0) {
            // some docs indicate addSchema() returns boolean, but the source code returns nothing
            tv4.addSchema(schema);
            schemas[typename] = schema;
            return true;
        }
        else {
            return false;
        }
    }
    else {
        // schema is already registered, don't re-register
        return true;
    }
}
// false if either the schema.id doesn't contain the typename or if the schema is invalid.
false if either the schema.id doesn't contain the typename or if the schema is invalid.
false if either the schema . id doesn ' t contain the typename or if the schema is invalid .
function registerSchema(schema) {
    var typename = getTypenameFromSchemaID(schema.id);
    var registered_schema = tv4.getSchema(schema.id);
    if (registered_schema == null) {
        var is_draft_schema = (schema.id === exports.DRAFT_SCHEMA_ID);
        if (!is_draft_schema) {
            if (typename == null) {
                return false;
            }
        }
        else {
            typename = exports.DRAFT_SCHEMA_TYPENAME;
        }
        var result = tv4_validateSchema(schema);
        if (result.errors.length === 0) {
            tv4.addSchema(schema);
            schemas[typename] = schema;
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return true;
    }
}
function registerSchema ( schema ) { var typename = getTypenameFromSchemaID ( schema . id ) ; var registered_schema = tv4 . getSchema ( schema . id ) ; if ( registered_schema == null ) { var is_draft_schema = ( schema . id === exports . DRAFT_SCHEMA_ID ) ; if ( ! is_draft_schema ) { if ( typename == null ) { return false ; } } else { typename = exports . DRAFT_SCHEMA_TYPENAME ; } var result = tv4_validateSchema ( schema ) ; if ( result . errors . length === 0 ) { tv4 . addSchema ( schema ) ; schemas [ typename ] = schema ; return true ; } else { return false ; } } else { return true ; } }
false if either the schema.id doesn't contain the typename or if the schema is invalid.
false if either the schema . id doesn ' t contain the typename or if the schema is invalid .
// error typename not available from id // some docs indicate addSchema() returns boolean, but the source code returns nothing // schema is already registered, don't re-register