code: function compile( schema, sourceRef, options = {} ) {
        const {
           isFeaturesValidator = false,
           interpolateExpressions = false
        } = options;
  
        const decorators = [
           translateCustomKeywordFormats
        ];
  
        if( !schema.$schema ) {
           throw new Error(
              `JSON schema for artifact "${sourceRef}" is missing "$schema" property`
           );
        }
        if( isFeaturesValidator ) {
           if( !schema.type ) {
              throw new Error(
                 `JSON schema for artifact "${sourceRef}" is missing "type" property (should be "object")`
              );
           }
           if( schema.type !== 'object' && schema.type !== 'array' ) {
              throw new Error(
                 `JSON schema for artifact "${sourceRef}" root element should have type "object"`
              );
           }
  
           decorators.push( setAdditionalPropertiesDefaults );
           decorators.push( setFirstLevelDefaults );
           decorators.push( extractFeatures );
        }
        if( interpolateExpressions ) {
           decorators.push( schema => {
              applyToSchemas( schema, schema => {
                 if( schema.default ) {
                    schema[ AX_INTERPOLATE ] = true;
                 }
              } );
           } );
        }
  
        const decoratedSchema = decorators.reduce( ( schema, decorator ) => {
           return decorator( schema ) || schema;
        }, schema );
  
        try {
           return ajv.compile( decoratedSchema );
        }
        catch( e ) {
           throw new Error( `Failed to compile JSON schema for artifact "${sourceRef}":\n${e}` );
        }
     }
docs: /////////////////////////////////////////////////////////////////////////////////////////////////////////