def validate(self, body_to_validate):
try:<EOL><INDENT>for validation_spec in self._validation_specs:<EOL><INDENT>self._validate_field(validation_spec=validation_spec,<EOL>dictionary_to_validate=body_to_validate)<EOL><DEDENT><DEDENT>except GcpFieldValidationException as e:<EOL><INDENT>raise GcpFieldValidationException(<EOL>"<STR_LIT>".<EOL>format(body_to_validate, e))<EOL><DEDENT>all_field_names = [spec['<STR_LIT:name>'] for spec in self._validation_specs<EOL>if spec.get('<STR_LIT:type>') != '<STR_LIT>' and<EOL>spec.get('<STR_LIT>') != self._api_version]<EOL>all_union_fields = [spec for spec in self._validation_specs<EOL>if spec.get('<STR_LIT:type>') == '<STR_LIT>']<EOL>for union_field in all_union_fields:<EOL><INDENT>all_field_names.extend(<EOL>[nested_union_spec['<STR_LIT:name>'] for nested_union_spec in union_field['<STR_LIT>']<EOL>if nested_union_spec.get('<STR_LIT:type>') != '<STR_LIT>' and<EOL>nested_union_spec.get('<STR_LIT>') != self._api_version])<EOL><DEDENT>for field_name in body_to_validate.keys():<EOL><INDENT>if field_name not in all_field_names:<EOL><INDENT>self.log.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>field_name, self._validation_specs)<EOL><DEDENT><DEDENT>
Validates if the body (dictionary) follows specification that the validator was
instantiated with. Raises ValidationSpecificationException or
ValidationFieldException in case of problems with specification or the
body not conforming to the specification respectively.

:param body_to_validate: body that must follow the specification
:type body_to_validate: dict
:return: None