amd/tv4-via-typenames.js
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;
        }
    }
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;
        }
    }
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 ; } }
Regisiter the schema with the schema validation system. The schema is validated by this function, and registered only if it is valid. If a schema with this schema's typename has already been registered, then this returns true with no other action. @return true if successful, or if the schema had already been registered. false if either the schema.id doesn't contain the typename or if the schema is invalid.
Regisiter the schema with the schema validation system . The schema is validated by this function and registered only if it is valid . If a schema with this schema s typename has already been registered then this returns true with no other action .