import json
from jsonschema import validate
from metalpipe.metalpipe_processor import MetalPipeProcessor


class JsonValidator(MetalPipeProcessor):
    def __init__(self, schema_filename):

        with open(schema_filename, "r") as json_schema_file:
            self.schema = json.load(json_schema_file)

        super(JsonValidator, self).__init__()

    def process_item(self):
        if isinstance(self.message, str):
            self.message = json.loads(self.message)
        try:
            validate(item, self.schema)
            return self.message
        except ValidationError:
            pass  # We'll log the error here

576b602532e2dde20d52c5f784f18afbe96263af
<mask token>


class JsonValidator(MetalPipeProcessor):
    <mask token>
    <mask token>

<mask token>


class JsonValidator(MetalPipeProcessor):

    def __init__(self, schema_filename):
        with open(schema_filename, 'r') as json_schema_file:
            self.schema = json.load(json_schema_file)
        super(JsonValidator, self).__init__()
    <mask token>

<mask token>


class JsonValidator(MetalPipeProcessor):

    def __init__(self, schema_filename):
        with open(schema_filename, 'r') as json_schema_file:
            self.schema = json.load(json_schema_file)
        super(JsonValidator, self).__init__()

    def process_item(self):
        if isinstance(self.message, str):
            self.message = json.loads(self.message)
        try:
            validate(item, self.schema)
            return self.message
        except ValidationError:
            pass

import json
from jsonschema import validate
from metalpipe.metalpipe_processor import MetalPipeProcessor


class JsonValidator(MetalPipeProcessor):

    def __init__(self, schema_filename):
        with open(schema_filename, 'r') as json_schema_file:
            self.schema = json.load(json_schema_file)
        super(JsonValidator, self).__init__()

    def process_item(self):
        if isinstance(self.message, str):
            self.message = json.loads(self.message)
        try:
            validate(item, self.schema)
            return self.message
        except ValidationError:
            pass

import json
from jsonschema import validate
from metalpipe.metalpipe_processor import MetalPipeProcessor


class JsonValidator(MetalPipeProcessor):
    def __init__(self, schema_filename):

        with open(schema_filename, "r") as json_schema_file:
            self.schema = json.load(json_schema_file)

        super(JsonValidator, self).__init__()

    def process_item(self):
        if isinstance(self.message, str):
            self.message = json.loads(self.message)
        try:
            validate(item, self.schema)
            return self.message
        except ValidationError:
            pass  # We'll log the error here
