text: import Ajv from 'ajv';
  import { JSONSchemaBridge } from 'uniforms-bridge-json-schema';
  
  const ajv = new Ajv({ allErrors: true, useDefaults: true });
  
  const schema = {
    title: 'DisplayIf',
    type: 'object',
    properties: {
      fieldA: { type: 'string' },
      fieldB: { type: 'string' }
    }
  };
  
  function createValidator(schema) {
    const validator = ajv.compile(schema);
  
    return model => {
      validator(model);
  
      if (validator.errors && validator.errors.length) {
        throw { details: validator.errors };
      }
    };
  }
  
  const schemaValidator = createValidator(schema);
  
  export default new JSONSchemaBridge(schema, schemaValidator);
  