Validate action from the request json,
            according to APPLY_CONNECTIVITY_CHANGES_ACTION_REQUIRED_ATTRIBUTE_LIST
963193
def _validate_request_action(self, action):
        
        is_fail = False
        fail_attribute = ""
        for class_attribute in self.APPLY_CONNECTIVITY_CHANGES_ACTION_REQUIRED_ATTRIBUTE_LIST:
            if type(class_attribute) is tuple:
                if not hasattr(action, class_attribute[0]):
                    is_fail = True
                    fail_attribute = class_attribute[0]
                if not hasattr(getattr(action, class_attribute[0]), class_attribute[1]):
                    is_fail = True
                    fail_attribute = class_attribute[1]
            else:
                if not hasattr(action, class_attribute):
                    is_fail = True
                    fail_attribute = class_attribute

        if is_fail:
            raise Exception(self.__class__.__name__,
                            "Mandatory field {0} is missing in ApplyConnectivityChanges request json".format(
                                fail_attribute))
556285
public function validate()
    {
        if (!empty($this->required)) {
            $invalid = array_diff($this->required, array_keys($this->request->args()));
            if (!empty($invalid)) {
                foreach ($invalid as $argKey) {
                    $this->request->addResult("{$argKey} required for this request.");
                }
                throw new ActionException($this, "Required arguments " . implode(', ', $invalid) . " not specified.");
            }
        }
    }
730563
public void validateAttributesForm(
            AttributeSwapRequest attributeSwapRequest, MessageContext context) {
        final RequestContext requestContext = RequestContextHolder.getRequestContext();
        final ExternalContext externalContext = requestContext.getExternalContext();
        final Set<String> swappableAttributes =
                this.attributeSwapperHelper.getSwappableAttributes(externalContext);

        final Map<String, Attribute> currentAttributes =
                attributeSwapRequest.getCurrentAttributes();
        this.checkAttributesMap(
                context, "currentAttributes", swappableAttributes, currentAttributes);

        final Map<String, Attribute> attributesToCopy = attributeSwapRequest.getAttributesToCopy();
        this.checkAttributesMap(context, "attributesToCopy", swappableAttributes, attributesToCopy);
    }
962662
public void required(String tagName, String actionName, String attributeName, Object attribute) throws ApplicationException {
	if (attribute == null)
	    throw new ApplicationException("Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]");

    }
1315667
def _validate_json_for_regular_workflow(json_spec, args):
    
    validated = {}
    override_project_id, override_folder, override_workflow_name = \
        dxpy.executable_builder.get_parsed_destination(args.destination)
    validated['project'] = _get_destination_project(json_spec, args, override_project_id)
    validated['folder'] = _get_destination_folder(json_spec, override_folder)

    workflow_name = _get_workflow_name(json_spec, override_workflow_name)
    if not workflow_name:
        print('Warning: workflow name is not specified')
    else:
        validated['name'] = workflow_name
    return validated
427120
def _make_request(self, action, params=None):
        
        ct = 'application/x-www-form-urlencoded; charset=UTF-8'
        headers = {'Content-Type': ct}
        params = params or {}
        params['Action'] = action

        for k, v in params.items():
            if isinstance(v, unicode):  # UTF-8 encode only if it's Unicode
                params[k] = v.encode('utf-8')

        response = super(SESConnection, self).make_request(
            'POST',
            '/',
            headers=headers,
            data=urllib.urlencode(params)
        )
        body = response.read()
        if response.status == 200:
            list_markers = ('VerifiedEmailAddresses', 'SendDataPoints')
            e = boto.jsonresponse.Element(list_marker=list_markers)
            h = boto.jsonresponse.XmlHandler(e, None)
            h.parse(body)
            return e
        else:
            # HTTP codes other than 200 are considered errors. Go through
            # some error handling to determine which exception gets raised,
            self._handle_error(response, body)
1241147
def validate(in_, options=None):
    
    obj_json = json.load(in_)

    results = validate_parsed_json(obj_json, options)

    return results
418756
def _prepare_request_json(self, kwargs):
        """"""

        # Check for python keywords in dict
        kwargs = self._check_for_python_keywords(kwargs)

        # Check for the key 'check' in kwargs
        if 'check' in kwargs:
            od = OrderedDict()
            od['check'] = kwargs['check']
            kwargs.pop('check')
            od.update(kwargs)
            return od
        return kwargs
798807
def _checkAction(self, action, value):
        '''
        '''
        if action is None:
            raise WSActionException, 'Response missing WSAddress Action'
        if not value:
            raise WSActionException, 'missing WSAddress Action, expecting %s' %action
        if value != action:
            raise WSActionException, 'wrong WSAddress Action(%s), expecting %s'%(value,action)
365996
function validate (errObj, request, schema, location, allowUnknown, context) {
  if (!request || !schema) return;

  var joiOptions = {
    context: context || request,
    allowUnknown: allowUnknown,
    abortEarly: false
  };

  Joi.validate(request, schema, joiOptions, function (errors, value) {
    if (!errors || errors.details.length === 0) {
      assignIn(request, value); // joi responses are parsed into JSON
      return;
    }
    errors.details.forEach(function (error) {
      var errorExists = find(errObj, function (item) {
        if (item && item.field === error.path && item.location === location) {
          item.messages.push(error.message);
          item.types.push(error.type);
          return item;
        }
        return;
      });

      if (!errorExists) {
        errObj.push({
          field: error.path,
          location: location,
          messages: [error.message],
          types: [error.type]
        });
      }

    });
  });
}
558562
def validate(self):
        
        if not self.principals:
            raise InvalidApplicationPolicyError(error_message='principals not provided')

        if not self.actions:
            raise InvalidApplicationPolicyError(error_message='actions not provided')

        if any(not self._PRINCIPAL_PATTERN.match(p) for p in self.principals):
            raise InvalidApplicationPolicyError(
                error_message='principal should be 12-digit AWS account ID or "*"')

        unsupported_actions = sorted(set(self.actions) - set(self.SUPPORTED_ACTIONS))
        if unsupported_actions:
            raise InvalidApplicationPolicyError(
                error_message='{} not supported'.format(', '.join(unsupported_actions)))

        return True
586823
protected function validate()
    {
        $args = $this->dispatcher->getParam('args');
        if (isset($this->actions[$this->actionName])) {
            $action = $this->actions[$this->actionName];
            $action->validate($args);
        }
    }
1180910
public ZooActionBuilder validate(String jsonPath, String expectedValue) {
        JsonPathMessageValidationContext validationContext = action.getJsonPathMessageValidationContext();
        if (validationContext == null) {
            validationContext = new JsonPathMessageValidationContext();
            action.setJsonPathMessageValidationContext(validationContext);
        }
        validationContext.getJsonPathExpressions().put(jsonPath, expectedValue);
        return this;
    }
22117
def validate_object_action(self, action_name, obj=None):
        
        action_method = getattr(self, action_name)
        if not getattr(action_method, 'detail', False) and action_name not in ('update', 'partial_update', 'destroy'):
            # DRF does not add flag 'detail' to update and delete actions, however they execute operation with
            # particular object. We need to enable validation for them too.
            return
        validators = getattr(self, action_name + '_validators', [])
        for validator in validators:
            validator(obj or self.get_object())
9139
def validate_json(data: str):
    
    result = None
    try:
        result = json.loads(data)
    except ValueError as error:
        log(ERROR, "invalid json: %s", error)

    return result
550882
def json_validate(schema, resp):
    
    # is this an error?
    try:
        json_validate_error(resp)
    except ValidationError:
        if json_is_exception(resp):
            # got a traceback 
            if BLOCKSTACK_TEST:
                log.error('\n{}'.format(resp['traceback']))

            return {'error': 'Blockstack Core encountered an exception. See `traceback` for details', 'traceback': resp['traceback'], 'http_status': 500}

        if 'error' in resp and 'http_status' not in resp:
            # bad error message
            raise 

        # not an error.
        jsonschema.validate(resp, schema)

    return resp
796440
def validate_host_port(action)
      raise JSS::UnsupportedError, "Cannot #{action} without first setting a host_name and port" if host_name.to_s.empty? || port.to_s.empty?
    end