Validate model and return validation result object
        :param model:  object or dict
        :param context: object, dict or None
        :return: shiftschema.result.Result
549247
def validate(self, model=None, context=None):
        

        # inject with settings
        result = Result(translator=self.translator, locale=self.locale)

        # validate state
        state_result = self.validate_state(model, context=context)
        result.merge(state_result)

        # validate simple properties
        props_result = self.validate_properties(model, context=context)
        result.merge(props_result)

        # validate nested entity properties
        entities_result = self.validate_entities(model, context=context)
        result.merge(entities_result)

        # validate collection properties
        collections_result = self.validate_collections(model, context=context)
        result.merge(collections_result)

        # and return
        return result
398591
def _resolve(value, model_instance=None, context=None):
    

    if isinstance(value, basestring) and "{" in value:
        if context is None:
            context = Context()
        if model_instance is not None:
            context[model_instance._meta.module_name] = model_instance
        value = Template(value).render(context)
    return value
884795
def validate(instance):
    

    jsonschema.validate(
        to_dict(instance, dict_type=dict), build_schema(instance.__class__)
    )
688876
def validate_properties(self, model, context=None):
        
        result = Result()
        for property_name in self.properties:
            prop = self.properties[property_name]
            value = self.get(model, property_name)
            errors = prop.validate(
                value=value,
                model=model,
                context=context
            )

            if errors:
                result.add_errors(
                    errors=errors,
                    property_name=property_name
                )

        return result
1226941
def validate_context(context):
  
  # Service must exist in service registry
  if not context.service_registry.service_record(context.service_name):
    fail("service: {} not found in service registry: {}".format(
         context.service_name, context.service_registry.filespec))
  service_type = context.service_registry.service_record(context.service_name)["type"]

  # Key must be valid
  if context.key not in EFConfig.VERSION_KEYS:
    fail("invalid key: {}; see VERSION_KEYS in ef_config for supported keys".format(context.key))

  # Lookup allowed key for service type
  if "allowed_types" in EFConfig.VERSION_KEYS[context.key] and \
          service_type not in EFConfig.VERSION_KEYS[context.key]["allowed_types"]:
    fail("service_type: {} is not allowed for key {}; see VERSION_KEYS[KEY]['allowed_types']"
         "in ef_config and validate service registry entry".format(service_type, context.key))

  return True
770352
def validateField(self, field) :
        """"""
        if field not in self.validators and not self.collection._validation['allow_foreign_fields'] :
            raise SchemaViolation(self.collection.__class__, field)

        if field in self.store:
            if isinstance(self.store[field], DocumentStore) :
                return self[field].validate()
            
            if field in self.patchStore :
                return self.validators[field].validate(self.patchStore[field])
            else :
                try :
                    return self.validators[field].validate(self.store[field])
                except ValidationError as e:
                    raise ValidationError( "'%s' -> %s" % ( field, str(e)) )
                except AttributeError:
                    if isinstance(self.validators[field], dict) and not isinstance(self.store[field], dict) :
                        raise ValueError("Validator expected a sub document for field '%s', got '%s' instead" % (field, self.store[field]) )
                    else :
                        raise
        return True
934654
def validate():
    ''''''
    with current_app.test_request_context():
        schema = json.loads(json.dumps(api.__schema__))
    try:
        schemas.validate(schema)
        success('API specifications are valid')
    except schemas.SchemaValidationError as e:
        exit_with_error('API specifications are not valid', e)
814195
def validate(self, value):
        
        ref_model = self.referenceModel()
        if isinstance(value, orb.Model):
            expected_schema = ref_model.schema().name()
            received_schema = value.schema().name()

            if expected_schema != received_schema:
                raise orb.errors.InvalidReference(self.name(),
                                                  expects=expected_schema,
                                                  received=received_schema)

        return super(ReferenceColumn, self).validate(value)
667368
function validateModel(json, model) {
    var schemaKeys = [];
    for (var keyInSchema in model) {
      schemaKeys.push(keyInSchema);
    }
    // Check if foreing keys are allowed.
    if (!model[SCHEMAALLOWUNKNOWN]) {
      // TODO ensure that null and false enter here.
      checkUnknown(json, schemaKeys);
    }
    for (var schemaKeyI = 0; schemaKeyI < schemaKeys.length; schemaKeyI++) {
      var node = null;
      var schemaKey = schemaKeys[schemaKeyI];
      if (json[schemaKey]) {
        node = json[schemaKey];
      }
      if (!isReservedWord(schemaKey)) {
        validateNode(node, model[schemaKey], schemaKey);
      }
    }
  }
27965
def get_for_model(self, model):
        
        # Return empty queryset if the given object is not valid.
        if not issubclass(model, models.Model):
            return self.none()

        content_type = ContentType.objects.get_for_model(model)

        return self.filter(content_type=content_type)
399195
def validate(self, data, context=None):
        
        try:
            self.load(data, context)
            return None
        except ValidationError as ve:
            return ve.messages
786273
def _validate_model(model):
    """"""
    if not hasattr(model, "as_search_document"):
        raise ImproperlyConfigured("'%s' must implement `as_search_document`." % model)
    if not hasattr(model.objects, "get_search_queryset"):
        raise ImproperlyConfigured(
            "'%s.objects must implement `get_search_queryset`." % model
        )
871141
def validate(obj, schema):
        
        if isinstance(obj, str):
            obj = json.loads(obj)
        return JsonValidator(schema)._validate(obj)
1133008
def _perform_validation(self, path, value, results):
        
        name = path if path != None else "value"
        value = ObjectReader.get_value(value)

        super(MapSchema, self)._perform_validation(path, value, results)

        if value == None:
            return

        if isinstance(value, dict):
            for (key, value) in value.items():
                element_path = key if path == None or len(path) == 0 else path + "." + key

                self._perform_type_validation(element_path, self.key_type, key, results)
                self._perform_type_validation(element_path, self.value_type, value, results)
        else:
            results.append(
                ValidationResult(
                    path,
                    ValidationResultType.Error,
                    "VALUE_ISNOT_MAP",
                    name + " type is expected to be Map",
                    "Map",
                    type(value)
                )
            )
893610
def validate(style):
    
    try:
        import jsonschema
    except ImportError:
        return

    try:
        jsonschema.validate(style, schema)
    except jsonschema.ValidationError as exc:
        new_exc = StyleValidationError(exc)
        # Don't dump the original jsonschema exception because it is already
        # included in the StyleValidationError's message.
        new_exc.__cause__ = None
        raise new_exc
354220
def validate(self, obj):
        

        if not isinstance(obj, self.model_class):
            raise ValidationError('Invalid object(%s) for service %s' % (type(obj), type(self)))
        LOG.debug(u'Object %s state: %s', self.model_class, obj.__dict__)
        obj.full_clean()
828650
def validate(obj, schema):
  """"""
  if not framework.EvaluationContext.current().validate:
    # Short circuit evaluation when disabled
    return obj

  # Validate returned object according to its own schema
  if hasattr(obj, 'tuple_schema'):
    obj.tuple_schema.validate(obj)
  # Validate object according to externally imposed schema
  if schema:
    schema.validate(obj)
  return obj